From 40934b8eff3b431a74cf0f7e386d7acac8a84c51 Mon Sep 17 00:00:00 2001 From: James Crayne Date: Sat, 3 Nov 2018 08:34:41 -0400 Subject: Reduce ncRequestInterval to 1 second Note: according to the spec, this is the maximum that tox core ever gets to. Tox core shortens it when there are more packets being recieved. This patch also adds some more debug messages. --- src/Network/Tox/Crypto/Handlers.hs | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) (limited to 'src/Network') diff --git a/src/Network/Tox/Crypto/Handlers.hs b/src/Network/Tox/Crypto/Handlers.hs index 02adbe31..b72a07e3 100644 --- a/src/Network/Tox/Crypto/Handlers.hs +++ b/src/Network/Tox/Crypto/Handlers.hs @@ -604,7 +604,7 @@ freshCryptoSession sessions ncPingMachine0 <- newTVar Nothing ncPingThread0 <- newTVar Nothing ncIdleEventThread0 <- newTVar Nothing - ncRequestInterval0 <- newTVar 7000 -- (TODO: shrink this) long interval while debugging slows trace flood + ncRequestInterval0 <- newTVar 1000 -- (TODO: shrink this) long interval while debugging slows trace flood ncAliveInterval0 <- newTVar 8000 -- 8 seconds -- ping Machine parameters fuzz <- return 0 -- randomRIO (0,2000) -- Fuzz to prevent simultaneous ping/pong exchanges. @@ -815,7 +815,10 @@ runUponHandshake netCryptoSession0 addr pktoq = do (nums,seqno) <- atomically $ PB.packetNumbersToRequest pktq dput XNetCrypto $ "(Request Thread) Missing Packets detected:" ++ show nums getOutGoingParam <- nqToWireIO pktoq - sendLossy crypto netCryptoSession0 (createRequestPacket seqno nums) + sendLossyResult <- sendLossy crypto netCryptoSession0 (createRequestPacket seqno nums) + case sendLossyResult of + Left e -> dput XNetCrypto ("SEND PACKET REQUEST FAILED: " ++ e) + _ -> dput XNetCrypto ( "SENT PACKET REQUEST (seqno=" ++ show seqno ++") " ++ show nums) loop dput XNetCrypto $ "runUponHandshake: " ++ show threadid ++ " = NetCryptoRequest." ++ show (key2id remotePublicKey) ++ sidStr @@ -1477,7 +1480,7 @@ handlePacketRequest session (CryptoData { bufferStart=num let resend (n,pkt) = sendSessionPacket (ncAllSessions session) addr pkt dput XNetCrypto ("Re-Sending Packets: " ++ show (map fst ps)) mapM_ resend ps - _ -> return () + _ -> dput XNetCrypto "ERROR: Incoming Packet request, yet no ncOutgoingQueue!" handlePacketRequest session cd = return () -- cgit v1.2.3