diff options
author | James Crayne <jim.crayne@gmail.com> | 2018-05-31 15:54:51 +0000 |
---|---|---|
committer | James Crayne <jim.crayne@gmail.com> | 2018-05-31 15:54:51 +0000 |
commit | 5edbd08b22598310839bb2ad4a779fc70c5c54b8 (patch) | |
tree | 050c8bc589f539f73c3107271ec2c11996d73dd2 /src/Network/Tox.hs | |
parent | 9045835b429e88e8cbcca2b41c126f664b53d471 (diff) |
{fresh,update}CryptoSession are now in STM
Diffstat (limited to 'src/Network/Tox.hs')
-rw-r--r-- | src/Network/Tox.hs | 23 |
1 files changed, 7 insertions, 16 deletions
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 | |||
323 | , hpTheirBaseNonce = Nothing | 323 | , hpTheirBaseNonce = Nothing |
324 | , hpTheirSessionKeyPublic = Nothing | 324 | , hpTheirSessionKeyPublic = Nothing |
325 | } | 325 | } |
326 | freshCryptoSession (toxCryptoSessions tox) saddr hp | 326 | newsession <- generateSecretKey |
327 | -- myhandshake <- do | 327 | timestamp <- getPOSIXTime |
328 | -- n24' <- atomically $ transportNewNonce crypto | 328 | -- (myhandshakeData,launchThreads) <- |
329 | -- dput XNetCrypto ("Handshake Nonce24: " <> show n24') | 329 | _ <- atomically $ freshCryptoSession (toxCryptoSessions tox) saddr newsession timestamp hp |
330 | -- newBaseNonce <- atomically $ transportNewNonce crypto | 330 | -- launchThreads |
331 | -- mbMyhandshakeData <- newHandShakeData crypto newBaseNonce hp saddr | 331 | -- forM myhandshake $ \response_handshake -> do |
332 | -- forM mbMyhandshakeData $ \hsdata -> do | 332 | -- sendHandshake sessions addr response_handshake |
333 | -- state <- lookupSharedSecret crypto myseckey theirpubkey n24' | ||
334 | -- return Handshake { handshakeCookie = cookie | ||
335 | -- , handshakeNonce = n24' | ||
336 | -- , handshakeData = encrypt state $ encodePlain hsdata | ||
337 | -- } | ||
338 | -- case myhandshake of | ||
339 | -- Nothing -> hPutStrLn stderr "netCrypto: failed to create HandshakeData." >> return [] | ||
340 | -- Just handshake -> do | ||
341 | -- sendMessage (toxCrypto tox) saddr (NetHandshake handshake) | ||
342 | let secnum :: Double | 333 | let secnum :: Double |
343 | secnum = fromIntegral millisecs / 1000000 | 334 | secnum = fromIntegral millisecs / 1000000 |
344 | delay = (millisecs * 5 `div` 4) | 335 | delay = (millisecs * 5 `div` 4) |