summaryrefslogtreecommitdiff
path: root/dht/src/Network
diff options
context:
space:
mode:
Diffstat (limited to 'dht/src/Network')
-rw-r--r--dht/src/Network/Tox/TCP.hs16
1 files changed, 6 insertions, 10 deletions
diff --git a/dht/src/Network/Tox/TCP.hs b/dht/src/Network/Tox/TCP.hs
index 36289e19..e3780675 100644
--- a/dht/src/Network/Tox/TCP.hs
+++ b/dht/src/Network/Tox/TCP.hs
@@ -146,16 +146,12 @@ tcpStream crypto mkst = StreamHandshake
146 dput XTCP $ "TCP exception: " ++ show e 146 dput XTCP $ "TCP exception: " ++ show e
147 return Nothing 147 return Nothing
148 , streamEncode = \y -> do 148 , streamEncode = \y -> do
149 -- dput XTCP $ "TCP(acquire nonce):" ++ show addr ++ " <-- " ++ show y 149 -- We need this to throw so the tcp session state can be cleaned up elsewhere.
150 n24 <- takeMVar nsend 150 bracket (takeMVar nsend) (putMVar nsend . incrementNonce24)
151 -- dput XTCP $ "TCP(got nonce):" ++ show addr ++ " <-- " ++ show y 151 $ \n24 -> do
152 let bs = encode $ encrypt (noncef' n24) $ encodePlain y 152 let bs = encode $ encrypt (noncef' n24) $ encodePlain y
153 ($ h) -- bracket (takeMVar hvar) (putMVar hvar) 153 hPut h (encode (fromIntegral $ Data.ByteString.length bs :: Word16) <> bs)
154 $ \h -> hPut h (encode (fromIntegral $ Data.ByteString.length bs :: Word16) <> bs) 154 dput XTCP $ "TCP: " ++ show addr ++ " <-- " ++ show y
155 `catchIOError` \e -> dput XTCP $ "TCP write exception: " ++ show e
156 -- dput XTCP $ "TCP(incrementing nonce): " ++ show addr ++ " <-- " ++ show y
157 putMVar nsend (incrementNonce24 n24)
158 dput XTCP $ "TCP: " ++ show addr ++ " <-- " ++ show y
159 } 155 }
160 , streamAddr = nodeAddr 156 , streamAddr = nodeAddr
161 } 157 }