summaryrefslogtreecommitdiff
path: root/src/Network/Tox/Crypto/Handlers.hs
diff options
context:
space:
mode:
Diffstat (limited to 'src/Network/Tox/Crypto/Handlers.hs')
-rw-r--r--src/Network/Tox/Crypto/Handlers.hs6
1 files changed, 5 insertions, 1 deletions
diff --git a/src/Network/Tox/Crypto/Handlers.hs b/src/Network/Tox/Crypto/Handlers.hs
index dbfaede6..35681c4a 100644
--- a/src/Network/Tox/Crypto/Handlers.hs
+++ b/src/Network/Tox/Crypto/Handlers.hs
@@ -370,6 +370,8 @@ data NetCryptoSession = NCrypto
370 -- ^ user interfaces may "listen" by inserting themselves into this map 370 -- ^ user interfaces may "listen" by inserting themselves into this map
371 -- with a unique id and a new TChan, and then reading from the TChan 371 -- with a unique id and a new TChan, and then reading from the TChan
372 } 372 }
373instance Eq NetCryptoSession where
374 x == y = ncSessionId x == ncSessionId y
373 375
374data NetCryptoSessions = NCSessions 376data NetCryptoSessions = NCSessions
375 { netCryptoSessions :: TVar (Map.Map SockAddr NetCryptoSession) 377 { netCryptoSessions :: TVar (Map.Map SockAddr NetCryptoSession)
@@ -1320,7 +1322,9 @@ defaultStatusMsgHook session cm@(UpToN {msgID=STATUSMESSAGE, msgBytes=msg}) = do
1320 1322
1321-- | updates ncLastNMsgs, and sends message to type-0 listeners 1323-- | updates ncLastNMsgs, and sends message to type-0 listeners
1322defaultUnRecHook :: MessageType -> NetCryptoHook 1324defaultUnRecHook :: MessageType -> NetCryptoHook
1323defaultUnRecHook = hookHelper False 1325defaultUnRecHook typ session cm = do
1326 dput XNetCrypto $ "(NetCrypto) defaultUnRecHook: packet (sessionid: " ++ show (ncSessionId session) ++ ") " ++ show cm
1327 hookHelper False typ session cm
1324 1328
1325hookHelper :: Bool -> MessageType -> NetCryptoHook 1329hookHelper :: Bool -> MessageType -> NetCryptoHook
1326hookHelper _ typ session cm | any ($ typ) [isKillPacket, isOFFLINE] = atomically $ do 1330hookHelper _ typ session cm | any ($ typ) [isKillPacket, isOFFLINE] = atomically $ do