summaryrefslogtreecommitdiff
path: root/src/Network/Tox
diff options
context:
space:
mode:
authorJoe Crayne <joe@jerkface.net>2018-08-18 16:46:30 -0400
committerJoe Crayne <joe@jerkface.net>2018-08-18 16:47:26 -0400
commitedbc10169d7cf363928bdcae2385b64cfdf54675 (patch)
tree610f3ad35e4b34a8b8748286c923b1af73ddfc78 /src/Network/Tox
parentfde5005a2d1ef3a0636cff21547d4cda22b7b215 (diff)
Split grokPacket into inbound/outbound versions.
Diffstat (limited to 'src/Network/Tox')
-rw-r--r--src/Network/Tox/Crypto/Handlers.hs8
1 files changed, 5 insertions, 3 deletions
diff --git a/src/Network/Tox/Crypto/Handlers.hs b/src/Network/Tox/Crypto/Handlers.hs
index db7543f7..57df4734 100644
--- a/src/Network/Tox/Crypto/Handlers.hs
+++ b/src/Network/Tox/Crypto/Handlers.hs
@@ -828,7 +828,7 @@ tryAppendQueueOutgoing getExtra outq msg = do
828 mbWire <- nqToWire outq getExtra nextno be pktno msg 828 mbWire <- nqToWire outq getExtra nextno be pktno msg
829 case mbWire of 829 case mbWire of
830 Just (payload,seqno) -> do 830 Just (payload,seqno) -> do
831 PB.grokPacket (nqPacketBuffer outq) (PacketSent seqno payload) 831 PB.grokOutboundPacket (nqPacketBuffer outq) (PacketSent seqno payload)
832 return $ OGSuccess payload 832 return $ OGSuccess payload
833 Nothing -> return OGEncodeFail 833 Nothing -> return OGEncodeFail
834 834
@@ -1181,7 +1181,8 @@ sessionPacketH sessions addrRaw (CryptoPacket nonce16 encrypted) = do
1181 ack = bufferStart -- Earliest sequence number they've seen from us. 1181 ack = bufferStart -- Earliest sequence number they've seen from us.
1182 if isLossy msgTypMapped 1182 if isLossy msgTypMapped
1183 then do dput XNetCrypto $ "enqueue ncPacketQueue Lossy " ++ show cm 1183 then do dput XNetCrypto $ "enqueue ncPacketQueue Lossy " ++ show cm
1184 atomically $ PB.grokPacket ncPacketBuffer (PacketReceivedLossy bufferEnd ack) 1184 atomically $ PB.grokInboundPacket ncPacketBuffer
1185 (PacketReceivedLossy bufferEnd ack)
1185 runCryptoHook session (bufferData cd) 1186 runCryptoHook session (bufferData cd)
1186 else do dput XNetCrypto $ "enqueue ncPacketQueue Lossless " ++ show cm 1187 else do dput XNetCrypto $ "enqueue ncPacketQueue Lossless " ++ show cm
1187 when (msgID cm == PING) $ 1188 when (msgID cm == PING) $
@@ -1192,7 +1193,8 @@ sessionPacketH sessions addrRaw (CryptoPacket nonce16 encrypted) = do
1192 -- num <- CB.getNextSequenceNum ncStoredRequests 1193 -- num <- CB.getNextSequenceNum ncStoredRequests
1193 -- CB.enqueue ncStoredRequests num cd 1194 -- CB.enqueue ncStoredRequests num cd
1194 handlePacketRequest session cd 1195 handlePacketRequest session cd
1195 atomically $ PB.grokPacket ncPacketBuffer (PacketReceived bufferEnd cd ack) 1196 atomically $ PB.grokInboundPacket ncPacketBuffer
1197 (PacketReceived bufferEnd cd ack)
1196 return Nothing 1198 return Nothing
1197 where 1199 where
1198 last2Bytes :: Nonce24 -> Word16 1200 last2Bytes :: Nonce24 -> Word16