diff options
author | James Crayne <jim.crayne@gmail.com> | 2018-05-29 03:36:02 +0000 |
---|---|---|
committer | James Crayne <jim.crayne@gmail.com> | 2018-05-29 03:36:02 +0000 |
commit | 1c65905502df013ab0076726aa919b91c14d7a4c (patch) | |
tree | 1d8eb5d891cc9a3d618d3de3ffcfaa40c28a75f6 /src/Network/Tox/Crypto/Handlers.hs | |
parent | 89f012de3884c56ed48932091ebe9c5d5a291d27 (diff) |
dput: suppressible debug prints
Diffstat (limited to 'src/Network/Tox/Crypto/Handlers.hs')
-rw-r--r-- | src/Network/Tox/Crypto/Handlers.hs | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/src/Network/Tox/Crypto/Handlers.hs b/src/Network/Tox/Crypto/Handlers.hs index 5a52450b..95cb1bc8 100644 --- a/src/Network/Tox/Crypto/Handlers.hs +++ b/src/Network/Tox/Crypto/Handlers.hs | |||
@@ -45,6 +45,7 @@ import PingMachine | |||
45 | import qualified Data.IntMap.Strict as IntMap | 45 | import qualified Data.IntMap.Strict as IntMap |
46 | import Control.Concurrent.Supply | 46 | import Control.Concurrent.Supply |
47 | import Data.InOrOut | 47 | import Data.InOrOut |
48 | import DPut | ||
48 | 49 | ||
49 | -- util, todo: move to another module | 50 | -- util, todo: move to another module |
50 | maybeToEither :: Maybe b -> Either String b | 51 | maybeToEither :: Maybe b -> Either String b |
@@ -536,7 +537,7 @@ updateCryptoSession sessions addr hp session = do | |||
536 | 537 | ||
537 | cryptoNetHandler :: NetCryptoSessions -> SockAddr -> NetCrypto -> IO (Maybe (NetCrypto -> NetCrypto)) | 538 | cryptoNetHandler :: NetCryptoSessions -> SockAddr -> NetCrypto -> IO (Maybe (NetCrypto -> NetCrypto)) |
538 | cryptoNetHandler sessions addr (NetHandshake (Handshake (Cookie n24 ecookie) nonce24 encrypted)) = do | 539 | cryptoNetHandler sessions addr (NetHandshake (Handshake (Cookie n24 ecookie) nonce24 encrypted)) = do |
539 | hPutStrLn stderr ("RECIEVED HANDSHAKE from " ++ show addr) | 540 | dput XNetCrypto ("RECIEVED HANDSHAKE from " ++ show addr) |
540 | -- Handle Handshake Message | 541 | -- Handle Handshake Message |
541 | let crypto = transportCrypto sessions | 542 | let crypto = transportCrypto sessions |
542 | allsessions = netCryptoSessions sessions | 543 | allsessions = netCryptoSessions sessions |
@@ -545,7 +546,7 @@ cryptoNetHandler sessions addr (NetHandshake (Handshake (Cookie n24 ecookie) non | |||
545 | seckeys <- map fst <$> atomically (readTVar (userKeys crypto)) | 546 | seckeys <- map fst <$> atomically (readTVar (userKeys crypto)) |
546 | symkey <- atomically $ transportSymmetric crypto | 547 | symkey <- atomically $ transportSymmetric crypto |
547 | now <- getPOSIXTime | 548 | now <- getPOSIXTime |
548 | hPutStrLn stderr ("Decrypt cookie with n24=" ++ show n24 ++ "\n symkey= " ++ show symkey) | 549 | dput XNetCrypto ("Decrypt cookie with n24=" ++ show n24 ++ "\n symkey= " ++ show symkey) |
549 | lr <- fmap join . sequence $ do -- Either Monad | 550 | lr <- fmap join . sequence $ do -- Either Monad |
550 | -- TODO: XXX: FIXME: | 551 | -- TODO: XXX: FIXME: |
551 | -- The following call to decryptSymmetric is failing every time, | 552 | -- The following call to decryptSymmetric is failing every time, |
@@ -579,7 +580,7 @@ cryptoNetHandler sessions addr (NetHandshake (Handshake (Cookie n24 ecookie) non | |||
579 | , hpCookieRemoteDhtkey = remoteDhtkey | 580 | , hpCookieRemoteDhtkey = remoteDhtkey |
580 | } | 581 | } |
581 | case lr of | 582 | case lr of |
582 | Left s -> hPutStrLn stderr ("cryptoNetHandler: " ++ s) | 583 | Left s -> dput XNetCrypto ("cryptoNetHandler: " ++ s) |
583 | Right hp@(HParam | 584 | Right hp@(HParam |
584 | { hpTheirBaseNonce = Just theirBaseNonce | 585 | { hpTheirBaseNonce = Just theirBaseNonce |
585 | , hpOtherCookie = otherCookie | 586 | , hpOtherCookie = otherCookie |