From 5edbd08b22598310839bb2ad4a779fc70c5c54b8 Mon Sep 17 00:00:00 2001 From: James Crayne Date: Thu, 31 May 2018 15:54:51 +0000 Subject: {fresh,update}CryptoSession are now in STM --- src/Network/Tox.hs | 23 +++++++---------------- 1 file changed, 7 insertions(+), 16 deletions(-) (limited to 'src/Network/Tox.hs') diff --git a/src/Network/Tox.hs b/src/Network/Tox.hs index 66a19097..c3e559d7 100644 --- a/src/Network/Tox.hs +++ b/src/Network/Tox.hs @@ -323,22 +323,13 @@ netCryptoWithBackoff millisecs tox myseckey theirpubkey = do , hpTheirBaseNonce = Nothing , hpTheirSessionKeyPublic = Nothing } - freshCryptoSession (toxCryptoSessions tox) saddr hp --- myhandshake <- do --- n24' <- atomically $ transportNewNonce crypto --- dput XNetCrypto ("Handshake Nonce24: " <> show n24') --- newBaseNonce <- atomically $ transportNewNonce crypto --- mbMyhandshakeData <- newHandShakeData crypto newBaseNonce hp saddr --- forM mbMyhandshakeData $ \hsdata -> do --- state <- lookupSharedSecret crypto myseckey theirpubkey n24' --- return Handshake { handshakeCookie = cookie --- , handshakeNonce = n24' --- , handshakeData = encrypt state $ encodePlain hsdata --- } --- case myhandshake of --- Nothing -> hPutStrLn stderr "netCrypto: failed to create HandshakeData." >> return [] --- Just handshake -> do --- sendMessage (toxCrypto tox) saddr (NetHandshake handshake) + newsession <- generateSecretKey + timestamp <- getPOSIXTime + -- (myhandshakeData,launchThreads) <- + _ <- atomically $ freshCryptoSession (toxCryptoSessions tox) saddr newsession timestamp hp + -- launchThreads + -- forM myhandshake $ \response_handshake -> do + -- sendHandshake sessions addr response_handshake let secnum :: Double secnum = fromIntegral millisecs / 1000000 delay = (millisecs * 5 `div` 4) -- cgit v1.2.3