summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorJames Crayne <jim.crayne@gmail.com>2018-11-03 08:34:41 -0400
committerJames Crayne <jim.crayne@gmail.com>2018-11-03 08:34:41 -0400
commit40934b8eff3b431a74cf0f7e386d7acac8a84c51 (patch)
treeff04b14a59daadee67405eb31e254998d38ca12f /src
parente150b800acd538edb4b769836bf76d9f29131a94 (diff)
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.
Diffstat (limited to 'src')
-rw-r--r--src/Network/Tox/Crypto/Handlers.hs9
1 files changed, 6 insertions, 3 deletions
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
604 ncPingMachine0 <- newTVar Nothing 604 ncPingMachine0 <- newTVar Nothing
605 ncPingThread0 <- newTVar Nothing 605 ncPingThread0 <- newTVar Nothing
606 ncIdleEventThread0 <- newTVar Nothing 606 ncIdleEventThread0 <- newTVar Nothing
607 ncRequestInterval0 <- newTVar 7000 -- (TODO: shrink this) long interval while debugging slows trace flood 607 ncRequestInterval0 <- newTVar 1000 -- (TODO: shrink this) long interval while debugging slows trace flood
608 ncAliveInterval0 <- newTVar 8000 -- 8 seconds 608 ncAliveInterval0 <- newTVar 8000 -- 8 seconds
609 -- ping Machine parameters 609 -- ping Machine parameters
610 fuzz <- return 0 -- randomRIO (0,2000) -- Fuzz to prevent simultaneous ping/pong exchanges. 610 fuzz <- return 0 -- randomRIO (0,2000) -- Fuzz to prevent simultaneous ping/pong exchanges.
@@ -815,7 +815,10 @@ runUponHandshake netCryptoSession0 addr pktoq = do
815 (nums,seqno) <- atomically $ PB.packetNumbersToRequest pktq 815 (nums,seqno) <- atomically $ PB.packetNumbersToRequest pktq
816 dput XNetCrypto $ "(Request Thread) Missing Packets detected:" ++ show nums 816 dput XNetCrypto $ "(Request Thread) Missing Packets detected:" ++ show nums
817 getOutGoingParam <- nqToWireIO pktoq 817 getOutGoingParam <- nqToWireIO pktoq
818 sendLossy crypto netCryptoSession0 (createRequestPacket seqno nums) 818 sendLossyResult <- sendLossy crypto netCryptoSession0 (createRequestPacket seqno nums)
819 case sendLossyResult of
820 Left e -> dput XNetCrypto ("SEND PACKET REQUEST FAILED: " ++ e)
821 _ -> dput XNetCrypto ( "SENT PACKET REQUEST (seqno=" ++ show seqno ++") " ++ show nums)
819 loop 822 loop
820 dput XNetCrypto $ "runUponHandshake: " ++ show threadid ++ " = NetCryptoRequest." ++ show (key2id remotePublicKey) ++ sidStr 823 dput XNetCrypto $ "runUponHandshake: " ++ show threadid ++ " = NetCryptoRequest." ++ show (key2id remotePublicKey) ++ sidStr
821 824
@@ -1477,7 +1480,7 @@ handlePacketRequest session (CryptoData { bufferStart=num
1477 let resend (n,pkt) = sendSessionPacket (ncAllSessions session) addr pkt 1480 let resend (n,pkt) = sendSessionPacket (ncAllSessions session) addr pkt
1478 dput XNetCrypto ("Re-Sending Packets: " ++ show (map fst ps)) 1481 dput XNetCrypto ("Re-Sending Packets: " ++ show (map fst ps))
1479 mapM_ resend ps 1482 mapM_ resend ps
1480 _ -> return () 1483 _ -> dput XNetCrypto "ERROR: Incoming Packet request, yet no ncOutgoingQueue!"
1481 1484
1482handlePacketRequest session cd = return () 1485handlePacketRequest session cd = return ()
1483 1486