diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/Network/Tox/Crypto/Handlers.hs | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/src/Network/Tox/Crypto/Handlers.hs b/src/Network/Tox/Crypto/Handlers.hs index 9e023b29..364e233e 100644 --- a/src/Network/Tox/Crypto/Handlers.hs +++ b/src/Network/Tox/Crypto/Handlers.hs | |||
@@ -394,6 +394,8 @@ ncToWire getState seqno bufend pktno msg = do | |||
394 | -- | called when we recieve a crypto handshake with valid cookie | 394 | -- | called when we recieve a crypto handshake with valid cookie |
395 | -- TODO set priority on contact addr to 0 if it is older than ForgetPeriod, | 395 | -- TODO set priority on contact addr to 0 if it is older than ForgetPeriod, |
396 | -- then increment it regardless. (Keep addr in MinMaxPSQ in Roster.Contact) | 396 | -- then increment it regardless. (Keep addr in MinMaxPSQ in Roster.Contact) |
397 | -- | ||
398 | -- This function sends a handshake response packet. | ||
397 | freshCryptoSession :: NetCryptoSessions -> SockAddr -> HandshakeParams -> IO () | 399 | freshCryptoSession :: NetCryptoSessions -> SockAddr -> HandshakeParams -> IO () |
398 | freshCryptoSession sessions | 400 | freshCryptoSession sessions |
399 | addr | 401 | addr |
@@ -426,8 +428,10 @@ freshCryptoSession sessions | |||
426 | , handshakeData = encrypted | 428 | , handshakeData = encrypted |
427 | } | 429 | } |
428 | let myhandshake= encodeHandshake <$> mbMyhandshakeData | 430 | let myhandshake= encodeHandshake <$> mbMyhandshakeData |
429 | ncMyPacketNonce0 <- atomically $ newTVar newBaseNonce | ||
430 | ncHandShake0 <- atomically $ newTVar myhandshake | 431 | ncHandShake0 <- atomically $ newTVar myhandshake |
432 | forM myhandshake $ \response_handshake -> do | ||
433 | sendMessage (sessionTransport sessions) addr (NetHandshake response_handshake) | ||
434 | ncMyPacketNonce0 <- atomically $ newTVar newBaseNonce | ||
431 | cookie0 <- atomically $ newTVar (Just otherCookie) | 435 | cookie0 <- atomically $ newTVar (Just otherCookie) |
432 | newsession <- generateSecretKey | 436 | newsession <- generateSecretKey |
433 | ncHooks0 <- atomically $ newTVar (defaultHooks sessions) | 437 | ncHooks0 <- atomically $ newTVar (defaultHooks sessions) |