From 992f67e2bb5134babb6195853e84fbcc7af02609 Mon Sep 17 00:00:00 2001 From: Robert Bermani Date: Thu, 23 Jul 2015 16:49:04 -0400 Subject: [PATCH] daily --- ex/Main.hs | 4 ++-- src/IB/Client.hs | 16 ++++++++-------- 2 files changed, 10 insertions(+), 10 deletions(-) diff --git a/ex/Main.hs b/ex/Main.hs index 5590ecc..affc9e2 100644 --- a/ex/Main.hs +++ b/ex/Main.hs @@ -54,10 +54,10 @@ main :: IO () main = do result <- connect defaultConf False True case result of - Left err -> putStrLn "Error" + Left err -> putStrLn "Unable to Connect" Right msv -> do s <- readMVar msv request s CurrentTimeReq - businessLogic msv + --businessLogic msv businessLogic :: MIB -> IO () diff --git a/src/IB/Client.hs b/src/IB/Client.hs index 88832f4..ce561ee 100644 --- a/src/IB/Client.hs +++ b/src/IB/Client.hs @@ -67,20 +67,19 @@ greetServer server = Left errMsg -> throwIO $ IBExc no_valid_id ParseError errMsg Right val -> do let serv_ver = pre_serverVersion val twsTime = pre_twsTime val - + sCo = server {s_connected= True} case () of _ | serv_ver < server_version -> throwIO $ IBExc no_valid_id UpdateTWS "" | serv_ver >= 3 -> if (serv_ver < min_server_ver_linking) - then write server $ show' ( s_clientId server) + then write sCo $ show' ( s_clientId sCo) else if (not extraAuth) - then request server StartApi + then request sCo StartApi else return () | otherwise -> return () - wFlush server - return server { s_twsTime = twsTime - , s_version = serv_ver - , s_connected = True - } + wFlush sCo + return sCo { s_twsTime = twsTime + , s_version = serv_ver + } @@ -161,6 +160,7 @@ toServer cc h debug = IBServer { s_addr = cc_addr cc , s_debug = debug , s_sock = Just h , s_timeoutInterval = 100000 + , s_connected = False } defaultConf :: ClientConfig