diff options
Diffstat (limited to 'dht/examples/dhtd.hs')
-rw-r--r-- | dht/examples/dhtd.hs | 22 |
1 files changed, 13 insertions, 9 deletions
diff --git a/dht/examples/dhtd.hs b/dht/examples/dhtd.hs index 42fcc67b..0f95f562 100644 --- a/dht/examples/dhtd.hs +++ b/dht/examples/dhtd.hs | |||
@@ -100,6 +100,7 @@ import qualified TCPProber as TCP | |||
100 | import Data.Typeable | 100 | import Data.Typeable |
101 | import Network.Tox.ContactInfo as Tox | 101 | import Network.Tox.ContactInfo as Tox |
102 | import Network.Tox.Onion.Routes | 102 | import Network.Tox.Onion.Routes |
103 | import Network.Tox.RelayPinger | ||
103 | import qualified Data.Word64Map as W64 | 104 | import qualified Data.Word64Map as W64 |
104 | import Network.Tox.AggregateSession | 105 | import Network.Tox.AggregateSession |
105 | import qualified Network.Tox.Session as Tox (Session) | 106 | import qualified Network.Tox.Session as Tox (Session) |
@@ -735,16 +736,19 @@ clientSession s@Session{..} sock cnum h = do | |||
735 | | otherwise = [show n, "error!","","",""] | 736 | | otherwise = [show n, "error!","","",""] |
736 | -- otherwise = [show n, "error!",show (IntMap.lookup n rm),show (IntMap.null rm),""] | 737 | -- otherwise = [show n, "error!",show (IntMap.lookup n rm),show (IntMap.null rm),""] |
737 | r = map (uncurry showRecord) rs | 738 | r = map (uncurry showRecord) rs |
739 | (rcnt,relays) <- currentRelays (tcpRelayPinger onionRouter) | ||
738 | return $ do | 740 | return $ do |
739 | hPutClientChunk h $ unlines [ "trampolines(UDP): " ++ show (IntMap.size uts,tcnt,icnt) | 741 | hPutClientChunk h $ unlines |
740 | ++ if tcpmode then "" else " *" | 742 | [ "trampolines(UDP): " ++ show (IntMap.size uts,tcnt,icnt) |
741 | , "trampolines(TCP): " ++ show (IntMap.size tts,ttcnt,ticnt) | 743 | ++ if tcpmode then "" else " *" |
742 | ++ if tcpmode then " *" else "" | 744 | , "trampolines(TCP): " ++ show (IntMap.size tts,ttcnt,ticnt) |
743 | , "active TCP: " ++ show (MM.size tcps) | 745 | ++ if tcpmode then " *" else "" |
744 | , "pending: " ++ show (W64.size pqs) | 746 | , "active TCP: " ++ show (MM.size tcps) |
745 | , "TCP spill,cache,queue: " | 747 | , "pending: " ++ show (W64.size pqs) |
746 | ++ show (PSQ.size tcp_spill, PSQ.size tcp_cache, PSQ.size tcp_queue)] | 748 | , "TCP spill,cache,queue: " |
747 | hPutClient h $ showColumns $ ["","responses","timeouts", "tcp", "age", "version"]:r | 749 | ++ show (PSQ.size tcp_spill, PSQ.size tcp_cache, PSQ.size tcp_queue)] |
750 | hPutClientChunk h $ showColumns $ ["","responses","timeouts", "tcp", "age", "version"]:r | ||
751 | hPutClient h $ unlines $ ("relays: " ++ show rcnt) : map (mappend " " . show) relays | ||
748 | 752 | ||
749 | ("onion", s) | "udp" <- strp $ map toLower s | 753 | ("onion", s) | "udp" <- strp $ map toLower s |
750 | -> cmd0 $ do | 754 | -> cmd0 $ do |