From d96aa110fcc32d9a8afb14564f45f296dd1624e4 Mon Sep 17 00:00:00 2001 From: "jim@bo" Date: Fri, 22 Jun 2018 15:06:51 -0400 Subject: packet request off by 1 serializatoin fix & getMissing fix --- src/Network/Tox/Crypto/Transport.hs | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'src/Network/Tox') diff --git a/src/Network/Tox/Crypto/Transport.hs b/src/Network/Tox/Crypto/Transport.hs index 678bb16d..ea8565b2 100644 --- a/src/Network/Tox/Crypto/Transport.hs +++ b/src/Network/Tox/Crypto/Transport.hs @@ -4,6 +4,7 @@ {-# LANGUAGE FlexibleInstances #-} {-# LANGUAGE LambdaCase #-} {-# LANGUAGE TupleSections #-} +{-# LANGUAGE StandaloneDeriving #-} module Network.Tox.Crypto.Transport ( parseCrypto , encodeCrypto @@ -97,7 +98,7 @@ encodeHandshakes x saddr = (B.cons 0x1a (runPut $ put x),saddr) createRequestPacket :: Word32 -> [Word32] -> CryptoMessage createRequestPacket seqno xs = UpToN PacketRequest (B.pack ns) where - ys = Prelude.map (subtract seqno) xs + ys = Prelude.map (subtract (seqno - 1)) xs reduceToSums [] = [] reduceToSums (x:xs) = x:(reduceToSums $ Prelude.map (subtract x) xs) makeZeroes :: Word32 -> [Word32] @@ -168,6 +169,8 @@ data CryptoPacket (f :: * -> *) = CryptoPacket , pktData :: f CryptoData } +deriving instance Show (CryptoPacket Encrypted) + instance Sized CryptoData where size = contramap bufferStart size <> contramap bufferEnd size -- cgit v1.2.3