From 4d00b88f1b9e5f71bdfde750c0495080ebd430f2 Mon Sep 17 00:00:00 2001 From: James Crayne Date: Fri, 1 Jun 2018 04:58:22 +0000 Subject: debug prints and remove unnecessary threadDelay --- src/Network/Tox/Crypto/Handlers.hs | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'src/Network/Tox/Crypto/Handlers.hs') diff --git a/src/Network/Tox/Crypto/Handlers.hs b/src/Network/Tox/Crypto/Handlers.hs index d3bf9606..ea70c72c 100644 --- a/src/Network/Tox/Crypto/Handlers.hs +++ b/src/Network/Tox/Crypto/Handlers.hs @@ -647,6 +647,7 @@ addSessionToMapIfNotThere sessions addrRaw netCryptoSession = do runUponHandshake :: NetCryptoSession -> SockAddr -> NetCryptoOutQueue -> IO () runUponHandshake netCryptoSession0 addr pktoq = do + dput XNetCrypto "(((((((runUponHandshake))))))) Launching threads" let sessions = ncAllSessions netCryptoSession0 pktq = ncPacketQueue netCryptoSession0 remotePublicKey = ncTheirPublicKey netCryptoSession0 @@ -662,6 +663,7 @@ runUponHandshake netCryptoSession0 addr pktoq = do cd <- atomically $ PQ.dequeue pktq _ <- runCryptoHook (netCryptoSession0 {ncDequeueThread=Just tid}) (bufferData cd) loop + dput XNetCrypto $ "runUponHandshake: " ++ show threadid ++ " = NetCryptoDequeue." ++ show (key2id remotePublicKey) -- launch dequeueOutgoing thread threadidOutgoing <- forkIO $ do tid <- myThreadId @@ -671,6 +673,7 @@ runUponHandshake netCryptoSession0 addr pktoq = do dput XNetCrypto "NetCryptoDequeueOutgoing thread... Sending encrypted Packet" sendSessionPacket sessions addr pkt loop + dput XNetCrypto $ "runUponHandshake: " ++ show threadidOutgoing ++ " = NetCryptoDequeueOutgoing." ++ show (key2id remotePublicKey) -- launch ping thread fuzz <- randomRIO (0,2000) pingMachine <- forkPingMachine ("NetCrypto." ++ show (key2id remotePublicKey)) (15000 + fuzz) 2000 @@ -679,6 +682,7 @@ runUponHandshake netCryptoSession0 addr pktoq = do -- add this session to the lookup maps -- atomically $ addSessionToMapIfNotThere sessions addr netCryptoSession -- run announceNewSessionHooks + dput XNetCrypto $ "runUponHandshake: Announcing new session" hooks <- atomically $ readTVar (announceNewSessionHooks sessions) flip fix (hooks,netCryptoSession) $ \loop (hooks,session) -> case hooks of -- cgit v1.2.3