From 41789213767b6422868011543cba1b71014ff166 Mon Sep 17 00:00:00 2001 From: James Crayne Date: Sat, 3 Nov 2018 09:35:14 -0400 Subject: PING missing from knownMsgs * Also Padding (0) should be handled special --- src/Network/Tox/Crypto/Handlers.hs | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) (limited to 'src/Network/Tox/Crypto') diff --git a/src/Network/Tox/Crypto/Handlers.hs b/src/Network/Tox/Crypto/Handlers.hs index aa63efee..bf01e1b5 100644 --- a/src/Network/Tox/Crypto/Handlers.hs +++ b/src/Network/Tox/Crypto/Handlers.hs @@ -1120,8 +1120,8 @@ sessionPacketH sessions addrRaw (CryptoPacket nonce16 encrypted) = do isLossy (Msg mid) | lossyness mid == Lossy = True isLossy _ = False ack = bufferStart -- Earliest sequence number they've seen from us. - if isLossy msgTypMapped - then do dput XNetCrypto $ "enqueue ncPacketQueue Lossy " ++ show cm + if (msgTypMapped /= Msg Padding && isLossy msgTypMapped) || isLossy msgTyp + then do dput XNetCrypto $ "enqueue ncPacketQueue Lossy (msgTyp=" ++ show msgTyp ++ " msgTypMapped=" ++show msgTypMapped ++ ") " ++ show cm atomically $ PB.grokInboundPacket ncPacketBuffer (PacketReceivedLossy bufferEnd cd ack) runCryptoHook session (bufferData cd) @@ -1231,7 +1231,8 @@ knownMsgs :: [Word64] knownMsgs = concat [ map (fromIntegral . fromEnum) [ PacketRequest .. KillPacket ] , map (const 0) [ 3 .. 15 ] -- UnspecifiedPacket - , map (const 0) [ 16 .. 23 ] -- MessengerLoseless + , map (fromIntegral . fromEnum) [ PING ] + , map (const 0) [ 17 .. 23 ] -- MessengerLoseless , map (fromIntegral . fromEnum) [ ONLINE .. OFFLINE ] , map (const 0) [ 26 .. 47 ] -- MessengerLoseless , map (fromIntegral . fromEnum) [ NICKNAME .. TYPING ] -- cgit v1.2.3