From 1c65905502df013ab0076726aa919b91c14d7a4c Mon Sep 17 00:00:00 2001 From: James Crayne Date: Tue, 29 May 2018 03:36:02 +0000 Subject: dput: suppressible debug prints --- src/Network/Tox/Crypto/Handlers.hs | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) (limited to 'src/Network/Tox/Crypto') 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 import qualified Data.IntMap.Strict as IntMap import Control.Concurrent.Supply import Data.InOrOut +import DPut -- util, todo: move to another module maybeToEither :: Maybe b -> Either String b @@ -536,7 +537,7 @@ updateCryptoSession sessions addr hp session = do cryptoNetHandler :: NetCryptoSessions -> SockAddr -> NetCrypto -> IO (Maybe (NetCrypto -> NetCrypto)) cryptoNetHandler sessions addr (NetHandshake (Handshake (Cookie n24 ecookie) nonce24 encrypted)) = do - hPutStrLn stderr ("RECIEVED HANDSHAKE from " ++ show addr) + dput XNetCrypto ("RECIEVED HANDSHAKE from " ++ show addr) -- Handle Handshake Message let crypto = transportCrypto sessions allsessions = netCryptoSessions sessions @@ -545,7 +546,7 @@ cryptoNetHandler sessions addr (NetHandshake (Handshake (Cookie n24 ecookie) non seckeys <- map fst <$> atomically (readTVar (userKeys crypto)) symkey <- atomically $ transportSymmetric crypto now <- getPOSIXTime - hPutStrLn stderr ("Decrypt cookie with n24=" ++ show n24 ++ "\n symkey= " ++ show symkey) + dput XNetCrypto ("Decrypt cookie with n24=" ++ show n24 ++ "\n symkey= " ++ show symkey) lr <- fmap join . sequence $ do -- Either Monad -- TODO: XXX: FIXME: -- The following call to decryptSymmetric is failing every time, @@ -579,7 +580,7 @@ cryptoNetHandler sessions addr (NetHandshake (Handshake (Cookie n24 ecookie) non , hpCookieRemoteDhtkey = remoteDhtkey } case lr of - Left s -> hPutStrLn stderr ("cryptoNetHandler: " ++ s) + Left s -> dput XNetCrypto ("cryptoNetHandler: " ++ s) Right hp@(HParam { hpTheirBaseNonce = Just theirBaseNonce , hpOtherCookie = otherCookie -- cgit v1.2.3