summaryrefslogtreecommitdiff
path: root/src/Network/Tox/AggregateSession.hs
diff options
context:
space:
mode:
authorJames Crayne <jim.crayne@gmail.com>2018-11-03 05:36:23 -0400
committerJames Crayne <jim.crayne@gmail.com>2018-11-03 05:36:23 -0400
commita73950e109950fb673f71e4168fd91cd8195fa29 (patch)
tree7bc4ba0ff964185bcacd6bfea322bdf84558288a /src/Network/Tox/AggregateSession.hs
parent1e02eb87763f1539b15bf92fe91cd67d00e64e44 (diff)
add sensible timeout to sendLossless
(also call this function from dispatchMessage)
Diffstat (limited to 'src/Network/Tox/AggregateSession.hs')
-rw-r--r--src/Network/Tox/AggregateSession.hs21
1 files changed, 1 insertions, 20 deletions
diff --git a/src/Network/Tox/AggregateSession.hs b/src/Network/Tox/AggregateSession.hs
index 26e7153a..27258a6f 100644
--- a/src/Network/Tox/AggregateSession.hs
+++ b/src/Network/Tox/AggregateSession.hs
@@ -242,26 +242,7 @@ dispatchMessage c msid msg = join $ atomically $ do
242 imap <- readTVar (contactSession c) 242 imap <- readTVar (contactSession c)
243 let go = case msid of Nothing -> forM_ imap 243 let go = case msid of Nothing -> forM_ imap
244 Just sid -> forM_ (IntMap.lookup sid imap) 244 Just sid -> forM_ (IntMap.lookup sid imap)
245 return $ go $ \con -> do 245 return $ go $ \con -> sendLossless (transportCrypto (ncAllSessions (singleSession con))) (singleSession con) msg
246 outq <- atomically $ do
247 mbOutq <- readTVar (ncOutgoingQueue $ singleSession con)
248 case mbOutq of
249 HaveHandshake outq -> return outq
250 NeedHandshake -> retry
251 extra <- nqToWireIO outq
252 r <- atomically $ do
253 rTry <- tryAppendQueueOutgoing extra outq msg
254 case rTry of
255 OGFull -> retry
256 OGSuccess x -> return (OGSuccess x)
257 OGEncodeFail -> return OGEncodeFail
258 case r of
259 OGSuccess x -> case ncSockAddr (singleSession con) of
260 HaveDHTKey saddr -> sendSessionPacket (ncAllSessions $ singleSession con) saddr x
261 _ -> return ()
262 OGEncodeFail -> dput XMisc ("FAILURE to Encode Outgoing: " ++ show msg)
263 _ -> return ()
264
265 246
266-- | Retry until: 247-- | Retry until:
267-- 248--