summaryrefslogtreecommitdiff
path: root/src/Network/Tox
diff options
context:
space:
mode:
authorJoe Crayne <joe@jerkface.net>2018-11-24 21:15:18 -0500
committerJoe Crayne <joe@jerkface.net>2018-12-16 14:08:26 -0500
commitb9d58803bafb2ae283c866df156e5422f58d6278 (patch)
tree17ace73da08dbeaf410281a22b40c03d9614fa48 /src/Network/Tox
parentc1d01920220bcab32b5a77c0b25e65518e8d90d4 (diff)
Remove padding for dependent-sum based messages.
Diffstat (limited to 'src/Network/Tox')
-rw-r--r--src/Network/Tox/Crypto/Transport.hs5
1 files changed, 3 insertions, 2 deletions
diff --git a/src/Network/Tox/Crypto/Transport.hs b/src/Network/Tox/Crypto/Transport.hs
index d1afaa38..6e2ab60b 100644
--- a/src/Network/Tox/Crypto/Transport.hs
+++ b/src/Network/Tox/Crypto/Transport.hs
@@ -270,12 +270,13 @@ sizeFor _ = size
270 270
271 271
272getCryptoMessage :: Word32 -> Get CryptoMessage 272getCryptoMessage :: Word32 -> Get CryptoMessage
273getCryptoMessage seqno = do 273getCryptoMessage seqno = fix $ \stripPadding -> do
274 t <- getWord8 274 t <- getWord8
275 case msgTag t of 275 case msgTag t of
276 Just (M Padding) -> stripPadding
276 Just (M msg) -> do x <- getPacket seqno 277 Just (M msg) -> do x <- getPacket seqno
277 return $ Pkt msg ==> x 278 return $ Pkt msg ==> x
278 Nothing -> return $ Pkt Padding ==> Padded mempty 279 Nothing -> return $ Pkt MESSAGE ==> "Unhandled packet: " <> T.pack (show t) -- $ Pkt Padding ==> Padded mempty
279 280
280putCryptoMessage :: Word32 -> CryptoMessage -> Put 281putCryptoMessage :: Word32 -> CryptoMessage -> Put
281putCryptoMessage seqno (Pkt t :=> Identity x) = do 282putCryptoMessage seqno (Pkt t :=> Identity x) = do