diff options
Diffstat (limited to 'Tox.hs')
-rw-r--r-- | Tox.hs | 9 |
1 files changed, 5 insertions, 4 deletions
@@ -597,7 +597,7 @@ newClient addr = do | |||
597 | -- recursive since 'updateRouting' does not invoke 'awaitMessage' which | 597 | -- recursive since 'updateRouting' does not invoke 'awaitMessage' which |
598 | -- which was modified by 'onInbound'. However, I'm going to avoid the | 598 | -- which was modified by 'onInbound'. However, I'm going to avoid the |
599 | -- mutual reference just to be safe. | 599 | -- mutual reference just to be safe. |
600 | outgoingClient = client { clientNet = net { awaitMessage = return Nothing } } | 600 | outgoingClient = client { clientNet = net { awaitMessage = ($ Nothing) } } |
601 | 601 | ||
602 | dispatch tbl var = DispatchMethods | 602 | dispatch tbl var = DispatchMethods |
603 | { classifyInbound = classify | 603 | { classifyInbound = classify |
@@ -608,6 +608,7 @@ newClient addr = do | |||
608 | -- handlers :: TVar -> Method -> Maybe Handler | 608 | -- handlers :: TVar -> Method -> Maybe Handler |
609 | handlers var PingType = handler PongType pingH | 609 | handlers var PingType = handler PongType pingH |
610 | handlers var GetNodesType = handler SendNodesType $ getNodesH routing | 610 | handlers var GetNodesType = handler SendNodesType $ getNodesH routing |
611 | {- | ||
611 | handlers var OnionRequest0 = noreply OnionRequest0 | 612 | handlers var OnionRequest0 = noreply OnionRequest0 |
612 | $ onionSend0H (symmetricCipher (return symkey) | 613 | $ onionSend0H (symmetricCipher (return symkey) |
613 | (fst <$> readTVar var) | 614 | (fst <$> readTVar var) |
@@ -616,6 +617,7 @@ newClient addr = do | |||
616 | handlers var OnionResponse1 = noreply OnionResponse1 | 617 | handlers var OnionResponse1 = noreply OnionResponse1 |
617 | $ onionResponse1H (symmetricDecipher (return symkey)) | 618 | $ onionResponse1H (symmetricDecipher (return symkey)) |
618 | udp | 619 | udp |
620 | -} | ||
619 | handlers var _ = Nothing | 621 | handlers var _ = Nothing |
620 | -- TODO DHTRequest public key (onion) | 622 | -- TODO DHTRequest public key (onion) |
621 | -- TODO DHTRequest NAT ping | 623 | -- TODO DHTRequest NAT ping |
@@ -690,12 +692,11 @@ dropEnd8 bs = B.take (B.length bs - 8) bs | |||
690 | 692 | ||
691 | -- Add detailed printouts for every packet. | 693 | -- Add detailed printouts for every packet. |
692 | addVerbosity tr = | 694 | addVerbosity tr = |
693 | tr { awaitMessage = do | 695 | tr { awaitMessage = \kont -> awaitMessage tr $ \m -> do |
694 | m <- awaitMessage tr | ||
695 | forM_ m $ mapM_ $ \(msg,addr) -> do | 696 | forM_ m $ mapM_ $ \(msg,addr) -> do |
696 | hPutStrLn stderr ( (show addr) | 697 | hPutStrLn stderr ( (show addr) |
697 | ++ " --> " ++ show (msgType msg)) | 698 | ++ " --> " ++ show (msgType msg)) |
698 | return m | 699 | kont m |
699 | , sendMessage = \addr msg -> do | 700 | , sendMessage = \addr msg -> do |
700 | hPutStrLn stderr ( (show addr) | 701 | hPutStrLn stderr ( (show addr) |
701 | ++ " <-- " ++ show (msgType msg)) | 702 | ++ " <-- " ++ show (msgType msg)) |