diff options
author | Joe Crayne <joe@jerkface.net> | 2018-11-24 21:15:18 -0500 |
---|---|---|
committer | Joe Crayne <joe@jerkface.net> | 2018-12-16 14:08:26 -0500 |
commit | b9d58803bafb2ae283c866df156e5422f58d6278 (patch) | |
tree | 17ace73da08dbeaf410281a22b40c03d9614fa48 /src/Network/Tox | |
parent | c1d01920220bcab32b5a77c0b25e65518e8d90d4 (diff) |
Remove padding for dependent-sum based messages.
Diffstat (limited to 'src/Network/Tox')
-rw-r--r-- | src/Network/Tox/Crypto/Transport.hs | 5 |
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 | ||
272 | getCryptoMessage :: Word32 -> Get CryptoMessage | 272 | getCryptoMessage :: Word32 -> Get CryptoMessage |
273 | getCryptoMessage seqno = do | 273 | getCryptoMessage 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 | ||
280 | putCryptoMessage :: Word32 -> CryptoMessage -> Put | 281 | putCryptoMessage :: Word32 -> CryptoMessage -> Put |
281 | putCryptoMessage seqno (Pkt t :=> Identity x) = do | 282 | putCryptoMessage seqno (Pkt t :=> Identity x) = do |