summaryrefslogtreecommitdiff
path: root/src/Network/Tox/Onion/Transport.hs
diff options
context:
space:
mode:
Diffstat (limited to 'src/Network/Tox/Onion/Transport.hs')
-rw-r--r--src/Network/Tox/Onion/Transport.hs7
1 files changed, 4 insertions, 3 deletions
diff --git a/src/Network/Tox/Onion/Transport.hs b/src/Network/Tox/Onion/Transport.hs
index 23fd369b..550a7730 100644
--- a/src/Network/Tox/Onion/Transport.hs
+++ b/src/Network/Tox/Onion/Transport.hs
@@ -79,6 +79,7 @@ import Network.Socket
79import System.IO 79import System.IO
80import qualified Text.ParserCombinators.ReadP as RP 80import qualified Text.ParserCombinators.ReadP as RP
81import Data.Hashable 81import Data.Hashable
82import DPut
82 83
83type HandleLo a = Maybe (Either String (ByteString, SockAddr)) -> IO a 84type HandleLo a = Maybe (Either String (ByteString, SockAddr)) -> IO a
84 85
@@ -481,17 +482,17 @@ handleOnionRequest :: forall a proxy n.
481 ) => proxy n -> TransportCrypto -> SockAddr -> UDPTransport -> IO a -> OnionRequest n -> IO a 482 ) => proxy n -> TransportCrypto -> SockAddr -> UDPTransport -> IO a -> OnionRequest n -> IO a
482handleOnionRequest proxy crypto saddr udp kont (OnionRequest nonce msg rpath) = do 483handleOnionRequest proxy crypto saddr udp kont (OnionRequest nonce msg rpath) = do
483 let n = peanoVal rpath 484 let n = peanoVal rpath
484 hPutStrLn stderr $ "handleOnionRequest " ++ show n 485 dput XOnion $ "handleOnionRequest " ++ show n
485 (sym, snonce) <- atomically ( (,) <$> transportSymmetric crypto 486 (sym, snonce) <- atomically ( (,) <$> transportSymmetric crypto
486 <*> transportNewNonce crypto ) 487 <*> transportNewNonce crypto )
487 peeled <- peelOnion crypto nonce msg 488 peeled <- peelOnion crypto nonce msg
488 case peeled of 489 case peeled of
489 Left e -> do 490 Left e -> do
490 -- todo report encryption error 491 -- todo report encryption error
491 hPutStrLn stderr $ unwords [ "peelOnion:", show n, either show show (either4or6 saddr), e] 492 dput XOnion $ unwords [ "peelOnion:", show n, either show show (either4or6 saddr), e]
492 kont 493 kont
493 Right (Addressed dst msg') -> do 494 Right (Addressed dst msg') -> do
494 hPutStrLn stderr $ unwords [ "peelOnion:", show n, either show show (either4or6 saddr), "-->", either show show (either4or6 dst), "SUCCESS"] 495 dput XOnion $ unwords [ "peelOnion:", show n, either show show (either4or6 saddr), "-->", either show show (either4or6 dst), "SUCCESS"]
495 sendMessage udp dst (runPut $ putRequest $ OnionRequest nonce msg' $ wrapSymmetric sym snonce saddr rpath) 496 sendMessage udp dst (runPut $ putRequest $ OnionRequest nonce msg' $ wrapSymmetric sym snonce saddr rpath)
496 kont 497 kont
497 498