summaryrefslogtreecommitdiff
path: root/src/Network
diff options
context:
space:
mode:
Diffstat (limited to 'src/Network')
-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