diff options
Diffstat (limited to 'src/Network/Tox')
-rw-r--r-- | src/Network/Tox/Crypto/Transport.hs | 5 |
1 files changed, 4 insertions, 1 deletions
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 @@ | |||
4 | {-# LANGUAGE FlexibleInstances #-} | 4 | {-# LANGUAGE FlexibleInstances #-} |
5 | {-# LANGUAGE LambdaCase #-} | 5 | {-# LANGUAGE LambdaCase #-} |
6 | {-# LANGUAGE TupleSections #-} | 6 | {-# LANGUAGE TupleSections #-} |
7 | {-# LANGUAGE StandaloneDeriving #-} | ||
7 | module Network.Tox.Crypto.Transport | 8 | module Network.Tox.Crypto.Transport |
8 | ( parseCrypto | 9 | ( parseCrypto |
9 | , encodeCrypto | 10 | , encodeCrypto |
@@ -97,7 +98,7 @@ encodeHandshakes x saddr = (B.cons 0x1a (runPut $ put x),saddr) | |||
97 | createRequestPacket :: Word32 -> [Word32] -> CryptoMessage | 98 | createRequestPacket :: Word32 -> [Word32] -> CryptoMessage |
98 | createRequestPacket seqno xs = UpToN PacketRequest (B.pack ns) | 99 | createRequestPacket seqno xs = UpToN PacketRequest (B.pack ns) |
99 | where | 100 | where |
100 | ys = Prelude.map (subtract seqno) xs | 101 | ys = Prelude.map (subtract (seqno - 1)) xs |
101 | reduceToSums [] = [] | 102 | reduceToSums [] = [] |
102 | reduceToSums (x:xs) = x:(reduceToSums $ Prelude.map (subtract x) xs) | 103 | reduceToSums (x:xs) = x:(reduceToSums $ Prelude.map (subtract x) xs) |
103 | makeZeroes :: Word32 -> [Word32] | 104 | makeZeroes :: Word32 -> [Word32] |
@@ -168,6 +169,8 @@ data CryptoPacket (f :: * -> *) = CryptoPacket | |||
168 | , pktData :: f CryptoData | 169 | , pktData :: f CryptoData |
169 | } | 170 | } |
170 | 171 | ||
172 | deriving instance Show (CryptoPacket Encrypted) | ||
173 | |||
171 | instance Sized CryptoData where | 174 | instance Sized CryptoData where |
172 | size = contramap bufferStart size | 175 | size = contramap bufferStart size |
173 | <> contramap bufferEnd size | 176 | <> contramap bufferEnd size |