Browse Source

BrokerServer: add keepalive settings

master
Denis Tereshkin 4 years ago
parent
commit
f6295cd0d6
  1. 6
      src/ATrade/Broker/Server.hs

6
src/ATrade/Broker/Server.hs

@ -77,6 +77,11 @@ startBrokerServer brokers c ep notificationsEp tradeSinks params = do @@ -77,6 +77,11 @@ startBrokerServer brokers c ep notificationsEp tradeSinks params = do
zapApplyCertificate cert notificationsSock
Nothing -> return ()
bind sock (T.unpack ep)
setTcpKeepAlive On notificationsSock
setTcpKeepAliveCount (restrict 5) notificationsSock
setTcpKeepAliveIdle (restrict 60) notificationsSock
setTcpKeepAliveInterval (restrict 10) notificationsSock
bind notificationsSock (T.unpack notificationsEp)
tid <- myThreadId
compMv <- newEmptyMVar
@ -121,6 +126,7 @@ notificationCallback state n = do @@ -121,6 +126,7 @@ notificationCallback state n = do
where
addNotification clientIdentity n = do
debugM "Broker.Server" $ "Sending notification to client [" <> T.unpack clientIdentity <> "]"
atomicMapIORef state (\s ->
case M.lookup clientIdentity . pendingNotifications $ s of
Just ns -> s { pendingNotifications = M.insert clientIdentity (n : ns) (pendingNotifications s)}

Loading…
Cancel
Save