summaryrefslogtreecommitdiff
path: root/src/Network
diff options
context:
space:
mode:
Diffstat (limited to 'src/Network')
-rw-r--r--src/Network/Tox.hs2
-rw-r--r--src/Network/Tox/Crypto/Handlers.hs4
2 files changed, 5 insertions, 1 deletions
diff --git a/src/Network/Tox.hs b/src/Network/Tox.hs
index c13c3b1a..a9b4f2e6 100644
--- a/src/Network/Tox.hs
+++ b/src/Network/Tox.hs
@@ -337,7 +337,7 @@ netCryptoWithBackoff millisecs tox myseckey theirpubkey = do
337 if secnum < 20000000 337 if secnum < 20000000
338 then do 338 then do
339 hPutStrLn stderr $ "sent handshake, now delaying " ++ show (secnum * 1.25) ++ " second(s).." 339 hPutStrLn stderr $ "sent handshake, now delaying " ++ show (secnum * 1.25) ++ " second(s).."
340 threadDelay delay 340 -- threadDelay delay
341 -- Commenting loop for simpler debugging 341 -- Commenting loop for simpler debugging
342 return [] -- netCryptoWithBackoff delay tox myseckey theirpubkey -- hopefully it will find an active session this time. 342 return [] -- netCryptoWithBackoff delay tox myseckey theirpubkey -- hopefully it will find an active session this time.
343 else do 343 else do
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
647 647
648runUponHandshake :: NetCryptoSession -> SockAddr -> NetCryptoOutQueue -> IO () 648runUponHandshake :: NetCryptoSession -> SockAddr -> NetCryptoOutQueue -> IO ()
649runUponHandshake netCryptoSession0 addr pktoq = do 649runUponHandshake netCryptoSession0 addr pktoq = do
650 dput XNetCrypto "(((((((runUponHandshake))))))) Launching threads"
650 let sessions = ncAllSessions netCryptoSession0 651 let sessions = ncAllSessions netCryptoSession0
651 pktq = ncPacketQueue netCryptoSession0 652 pktq = ncPacketQueue netCryptoSession0
652 remotePublicKey = ncTheirPublicKey netCryptoSession0 653 remotePublicKey = ncTheirPublicKey netCryptoSession0
@@ -662,6 +663,7 @@ runUponHandshake netCryptoSession0 addr pktoq = do
662 cd <- atomically $ PQ.dequeue pktq 663 cd <- atomically $ PQ.dequeue pktq
663 _ <- runCryptoHook (netCryptoSession0 {ncDequeueThread=Just tid}) (bufferData cd) 664 _ <- runCryptoHook (netCryptoSession0 {ncDequeueThread=Just tid}) (bufferData cd)
664 loop 665 loop
666 dput XNetCrypto $ "runUponHandshake: " ++ show threadid ++ " = NetCryptoDequeue." ++ show (key2id remotePublicKey)
665 -- launch dequeueOutgoing thread 667 -- launch dequeueOutgoing thread
666 threadidOutgoing <- forkIO $ do 668 threadidOutgoing <- forkIO $ do
667 tid <- myThreadId 669 tid <- myThreadId
@@ -671,6 +673,7 @@ runUponHandshake netCryptoSession0 addr pktoq = do
671 dput XNetCrypto "NetCryptoDequeueOutgoing thread... Sending encrypted Packet" 673 dput XNetCrypto "NetCryptoDequeueOutgoing thread... Sending encrypted Packet"
672 sendSessionPacket sessions addr pkt 674 sendSessionPacket sessions addr pkt
673 loop 675 loop
676 dput XNetCrypto $ "runUponHandshake: " ++ show threadidOutgoing ++ " = NetCryptoDequeueOutgoing." ++ show (key2id remotePublicKey)
674 -- launch ping thread 677 -- launch ping thread
675 fuzz <- randomRIO (0,2000) 678 fuzz <- randomRIO (0,2000)
676 pingMachine <- forkPingMachine ("NetCrypto." ++ show (key2id remotePublicKey)) (15000 + fuzz) 2000 679 pingMachine <- forkPingMachine ("NetCrypto." ++ show (key2id remotePublicKey)) (15000 + fuzz) 2000
@@ -679,6 +682,7 @@ runUponHandshake netCryptoSession0 addr pktoq = do
679 -- add this session to the lookup maps 682 -- add this session to the lookup maps
680 -- atomically $ addSessionToMapIfNotThere sessions addr netCryptoSession 683 -- atomically $ addSessionToMapIfNotThere sessions addr netCryptoSession
681 -- run announceNewSessionHooks 684 -- run announceNewSessionHooks
685 dput XNetCrypto $ "runUponHandshake: Announcing new session"
682 hooks <- atomically $ readTVar (announceNewSessionHooks sessions) 686 hooks <- atomically $ readTVar (announceNewSessionHooks sessions)
683 flip fix (hooks,netCryptoSession) $ \loop (hooks,session) -> 687 flip fix (hooks,netCryptoSession) $ \loop (hooks,session) ->
684 case hooks of 688 case hooks of