summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/Network/QueryResponse.hs7
-rw-r--r--src/Network/Tox/TCP.hs2
2 files changed, 6 insertions, 3 deletions
diff --git a/src/Network/QueryResponse.hs b/src/Network/QueryResponse.hs
index 01981cc8..c4ff50e3 100644
--- a/src/Network/QueryResponse.hs
+++ b/src/Network/QueryResponse.hs
@@ -231,7 +231,7 @@ asyncQuery_ (Client net d err pending whoami _) meth q addr0 withResponse = do
231 `catchIOError` (\e -> return Nothing) 231 `catchIOError` (\e -> return Nothing)
232 return (tid,now,expiry) 232 return (tid,now,expiry)
233 233
234asyncQuery :: Client err meth tid addr x 234asyncQuery :: Show meth => Client err meth tid addr x
235 -> MethodSerializer tid addr x meth a b 235 -> MethodSerializer tid addr x meth a b
236 -> a 236 -> a
237 -> addr 237 -> addr
@@ -240,9 +240,11 @@ asyncQuery :: Client err meth tid addr x
240asyncQuery client meth q addr withResponse0 = do 240asyncQuery client meth q addr withResponse0 = do
241 tm <- getSystemTimerManager 241 tm <- getSystemTimerManager
242 tidvar <- newEmptyMVar 242 tidvar <- newEmptyMVar
243 timedout <- registerTimeout tm 300000000 $ do 243 timedout <- registerTimeout tm 1000000 $ do
244 dput XMisc $ "async TIMEDOUT " ++ show (method meth)
244 withResponse0 Nothing 245 withResponse0 Nothing
245 tid <- takeMVar tidvar 246 tid <- takeMVar tidvar
247 dput XMisc $ "async TIMEDOUT mvar " ++ show (method meth)
246 case client of 248 case client of
247 Client { clientDispatcher = d, clientPending = pending } -> do 249 Client { clientDispatcher = d, clientPending = pending } -> do
248 atomically $ readTVar pending >>= dispatchCancel (tableMethods d) tid >>= writeTVar pending 250 atomically $ readTVar pending >>= dispatchCancel (tableMethods d) tid >>= writeTVar pending
@@ -251,6 +253,7 @@ asyncQuery client meth q addr withResponse0 = do
251 withResponse0 x 253 withResponse0 x
252 putMVar tidvar tid 254 putMVar tidvar tid
253 updateTimeout tm timedout expiry 255 updateTimeout tm timedout expiry
256 dput XMisc $ "FIN asyncQuery "++show (method meth)++" TIMEOUT="++show expiry
254 257
255-- | Send a query to a remote peer. Note that this function will always time 258-- | Send a query to a remote peer. Note that this function will always time
256-- out if 'forkListener' was never invoked to spawn a thread to receive and 259-- out if 'forkListener' was never invoked to spawn a thread to receive and
diff --git a/src/Network/Tox/TCP.hs b/src/Network/Tox/TCP.hs
index 9c1ffe48..13da804f 100644
--- a/src/Network/Tox/TCP.hs
+++ b/src/Network/Tox/TCP.hs
@@ -110,7 +110,7 @@ tcpStream crypto = StreamHandshake
110 , streamDecode = 110 , streamDecode =
111 let go h = decode <$> hGet h 2 >>= \case 111 let go h = decode <$> hGet h 2 >>= \case
112 Left e -> do 112 Left e -> do
113 dput XTCP $ "TCP: Failed to get length: " ++ e 113 dput XTCP $ "TCP: (" ++ show addr ++ ") Failed to get length: " ++ e
114 return Nothing 114 return Nothing
115 Right len -> do 115 Right len -> do
116 decode <$> hGet h (fromIntegral (len :: Word16)) >>= \case 116 decode <$> hGet h (fromIntegral (len :: Word16)) >>= \case