diff options
Diffstat (limited to 'src/Network')
-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 |