|
|
|
|
@ -22,7 +22,7 @@ import Config (SubscriptionConfig (Subscriptio
@@ -22,7 +22,7 @@ import Config (SubscriptionConfig (Subscriptio
|
|
|
|
|
transaqHost, transaqLogLevel, |
|
|
|
|
transaqLogPath, transaqLogin, |
|
|
|
|
transaqPassword, transaqPort) |
|
|
|
|
import Control.Concurrent (forkIO, threadDelay) |
|
|
|
|
import Control.Concurrent (threadDelay) |
|
|
|
|
import Control.Concurrent.STM (TVar, atomically, modifyTVar', |
|
|
|
|
orElse, putTMVar, readTMVar, |
|
|
|
|
readTVar, readTVarIO, |
|
|
|
|
@ -36,6 +36,7 @@ import qualified Data.Bimap as BM
@@ -36,6 +36,7 @@ import qualified Data.Bimap as BM
|
|
|
|
|
import Data.Maybe (mapMaybe) |
|
|
|
|
import qualified Data.Text as T |
|
|
|
|
import qualified Deque.Strict as D |
|
|
|
|
import SlaveThread (fork) |
|
|
|
|
import Text.XML.Light.Input (parseXML) |
|
|
|
|
import Text.XML.Light.Types (Content (Elem), |
|
|
|
|
Element (elName), |
|
|
|
|
@ -204,7 +205,7 @@ workThread = do
@@ -204,7 +205,7 @@ workThread = do
|
|
|
|
|
Just cb -> do |
|
|
|
|
serverConnectionState <- asks serverConnected |
|
|
|
|
timerVar' <- asks timerVar |
|
|
|
|
void $ liftIO $ forkIO $ whileM $ do |
|
|
|
|
void $ liftIO $ fork $ whileM $ do |
|
|
|
|
threadDelay 5000000 |
|
|
|
|
void . liftIO . atomically $ tryPutTMVar timerVar' () |
|
|
|
|
connStatus <- liftIO . readTVarIO $ serverConnectionState |
|
|
|
|
@ -427,7 +428,7 @@ handleConnected = do
@@ -427,7 +428,7 @@ handleConnected = do
|
|
|
|
|
Left result -> do |
|
|
|
|
case headMay (parseXML result) >>= parseContent of |
|
|
|
|
Just (TransaqResponseResult (ResponseSuccess (Just transactionId))) -> do |
|
|
|
|
State <- asks brokerState |
|
|
|
|
brState <- asks brokerState |
|
|
|
|
respVar <- asks responseVar |
|
|
|
|
liftIO $ atomically $ do |
|
|
|
|
modifyTVar' (bsOrderMap brState) (M.insert (orderId order) order) |
|
|
|
|
@ -475,7 +476,9 @@ handleConnected = do
@@ -475,7 +476,9 @@ handleConnected = do
|
|
|
|
|
requestTimeoutValue = 10 |
|
|
|
|
|
|
|
|
|
sendCancelOrder transactionId' = do |
|
|
|
|
v <- sendCommand . toXml $ (CommandCancelOrder $ toInteger transactionId) |
|
|
|
|
respVar <- asks responseVar |
|
|
|
|
resp <- liftIO . atomically $ readTMVar respVar |
|
|
|
|
v <- sendCommand . toXml $ (CommandCancelOrder $ toInteger transactionId') |
|
|
|
|
case v of |
|
|
|
|
Left result -> do |
|
|
|
|
log Debug "TXMLConnector.WorkThread" $ "Cancellation result: " <> (T.pack . show) result |
|
|
|
|
|