diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/Network/Tox/Crypto/Handlers.hs | 10 |
1 files changed, 7 insertions, 3 deletions
diff --git a/src/Network/Tox/Crypto/Handlers.hs b/src/Network/Tox/Crypto/Handlers.hs index 8975e4dc..fd04e1c5 100644 --- a/src/Network/Tox/Crypto/Handlers.hs +++ b/src/Network/Tox/Crypto/Handlers.hs | |||
@@ -467,6 +467,7 @@ ncToWire :: STM (State,Nonce24,U.RangeMap TArray Word8 TVar) | |||
467 | -> XMessage | 467 | -> XMessage |
468 | -> STM (Maybe (CryptoPacket Encrypted,Word32{-next packet no-})) | 468 | -> STM (Maybe (CryptoPacket Encrypted,Word32{-next packet no-})) |
469 | ncToWire getState seqno bufend pktno msg = do | 469 | ncToWire getState seqno bufend pktno msg = do |
470 | dtrace XNetCrypto ("ncToWire TOP OF FUNCTION " ++ show msg) (return ()) | ||
470 | let typ = getMessageType msg | 471 | let typ = getMessageType msg |
471 | typ64 = toWord64 typ | 472 | typ64 = toWord64 typ |
472 | let lsness msg = | 473 | let lsness msg = |
@@ -681,6 +682,7 @@ createNetCryptoOutQueue :: NetCryptoSessions -> SecretKey -> PublicKey -> Packet | |||
681 | createNetCryptoOutQueue sessions newsession theirSessionKey pktq ncMyPacketNonce0 ncOutgoingIdMap0 = do | 682 | createNetCryptoOutQueue sessions newsession theirSessionKey pktq ncMyPacketNonce0 ncOutgoingIdMap0 = do |
682 | let crypto = transportCrypto sessions | 683 | let crypto = transportCrypto sessions |
683 | let toWireIO = do | 684 | let toWireIO = do |
685 | dput XNetCrypto "=========== toWireIO TOP ===================" | ||
684 | f <- lookupNonceFunction crypto newsession theirSessionKey | 686 | f <- lookupNonceFunction crypto newsession theirSessionKey |
685 | atomically $ do | 687 | atomically $ do |
686 | n24 <- readTVar ncMyPacketNonce0 | 688 | n24 <- readTVar ncMyPacketNonce0 |
@@ -761,6 +763,7 @@ tryAppendQueueOutgoing :: STM (State, Nonce24, U.RangeMap TArray Word8 TVar) | |||
761 | -> CryptoMessage | 763 | -> CryptoMessage |
762 | -> STM (OutGoingResult (CryptoPacket Encrypted)) | 764 | -> STM (OutGoingResult (CryptoPacket Encrypted)) |
763 | tryAppendQueueOutgoing getExtra outq msg = do | 765 | tryAppendQueueOutgoing getExtra outq msg = do |
766 | dtrace XNetCrypto ("tryAppendQueueOutgoing=========>DEBUG====?> " ++ show msg) (return ()) | ||
764 | pktno <- readTVar (nqPacketNo outq) | 767 | pktno <- readTVar (nqPacketNo outq) |
765 | nextno <- PB.expectingSequenceNumber (nqPacketBuffer outq) | 768 | nextno <- PB.expectingSequenceNumber (nqPacketBuffer outq) |
766 | be <- PB.nextToSendSequenceNumber (nqPacketBuffer outq) | 769 | be <- PB.nextToSendSequenceNumber (nqPacketBuffer outq) |
@@ -1252,7 +1255,7 @@ sendCrypto :: TransportCrypto -> NetCryptoSession -> (STM ()) -> CryptoMessage - | |||
1252 | sendCrypto crypto session updateLocal cm = do | 1255 | sendCrypto crypto session updateLocal cm = do |
1253 | HaveHandshake outq <- atomically $ readTVar (ncOutgoingQueue session) | 1256 | HaveHandshake outq <- atomically $ readTVar (ncOutgoingQueue session) |
1254 | -- XXX: potential race? if shared secret comes out of sync with cache? | 1257 | -- XXX: potential race? if shared secret comes out of sync with cache? |
1255 | dput XNetCrypto "sendCrypto: enter " | 1258 | dput XNetCrypto ("sendCrypto: ENTER MESSAGE: " ++ show cm) |
1256 | getOutGoingParam <- nqToWireIO outq | 1259 | getOutGoingParam <- nqToWireIO outq |
1257 | dput XNetCrypto "sendCrypto: got the io extra stuff" | 1260 | dput XNetCrypto "sendCrypto: got the io extra stuff" |
1258 | ncTime <- atomically $ readTVar (ncTimeOut session) | 1261 | ncTime <- atomically $ readTVar (ncTimeOut session) |
@@ -1299,12 +1302,13 @@ sendOnlineHook crypto session cm = do | |||
1299 | sendOffline :: TransportCrypto -> NetCryptoSession -> IO (Either String (CryptoPacket Encrypted)) | 1302 | sendOffline :: TransportCrypto -> NetCryptoSession -> IO (Either String (CryptoPacket Encrypted)) |
1300 | sendOffline crypto session = do | 1303 | sendOffline crypto session = do |
1301 | let cm=OneByte OFFLINE | 1304 | let cm=OneByte OFFLINE |
1302 | sendLossless crypto session cm | 1305 | sendLossless crypto session (OneByte OFFLINE) |
1306 | |||
1303 | 1307 | ||
1304 | sendLossless :: TransportCrypto -> NetCryptoSession -> CryptoMessage -> IO (Either String (CryptoPacket Encrypted)) | 1308 | sendLossless :: TransportCrypto -> NetCryptoSession -> CryptoMessage -> IO (Either String (CryptoPacket Encrypted)) |
1305 | sendLossless crypto session cm = do | 1309 | sendLossless crypto session cm = do |
1306 | addMsgToLastN False (cm ^. messageType) session (Out cm) | 1310 | addMsgToLastN False (cm ^. messageType) session (Out cm) |
1307 | sendCrypto crypto session (return ()) (OneByte OFFLINE) | 1311 | sendCrypto crypto session (return ()) cm |
1308 | 1312 | ||
1309 | sendLossy :: TransportCrypto -> NetCryptoSession -> CryptoMessage -> IO (Either String (CryptoPacket Encrypted)) | 1313 | sendLossy :: TransportCrypto -> NetCryptoSession -> CryptoMessage -> IO (Either String (CryptoPacket Encrypted)) |
1310 | sendLossy crypto session cm = sendCryptoLossy crypto session (return ()) cm | 1314 | sendLossy crypto session cm = sendCryptoLossy crypto session (return ()) cm |