summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorjoe <joe@jerkface.net>2018-05-31 04:17:05 -0400
committerjoe <joe@jerkface.net>2018-05-31 04:17:05 -0400
commit897f9a5e39b8356133323024d84891cc3817ed6a (patch)
treedaa02928bbb91914bd889c18808678ec3afb94b9
parentfaf175df2255a279c780bc8b99a5dd1bc41fcbd5 (diff)
Send handshake response packet.
-rw-r--r--src/Network/Tox/Crypto/Handlers.hs6
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.
397freshCryptoSession :: NetCryptoSessions -> SockAddr -> HandshakeParams -> IO () 399freshCryptoSession :: NetCryptoSessions -> SockAddr -> HandshakeParams -> IO ()
398freshCryptoSession sessions 400freshCryptoSession 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)