summaryrefslogtreecommitdiff
path: root/examples/dhtd.hs
diff options
context:
space:
mode:
authorJoe Crayne <joe@jerkface.net>2018-12-12 18:27:13 -0500
committerJoe Crayne <joe@jerkface.net>2018-12-16 14:08:26 -0500
commit3b467bd5c287a6e99bf9a76c0bd06274b560a315 (patch)
treefc3ffa6ead9da1fa1424b2d9703f79fdc69841af /examples/dhtd.hs
parentd96234b9954fb2e41521eb437edf2fee7317f7d6 (diff)
cli: Report TCP prober stats with onion stats.
Diffstat (limited to 'examples/dhtd.hs')
-rw-r--r--examples/dhtd.hs7
1 files changed, 6 insertions, 1 deletions
diff --git a/examples/dhtd.hs b/examples/dhtd.hs
index 1223edc8..e4e32f28 100644
--- a/examples/dhtd.hs
+++ b/examples/dhtd.hs
@@ -683,6 +683,9 @@ clientSession s@Session{..} sock cnum h = do
683 icnt <- HashMap.size <$> readTVar (trampolineIds onionRouter) 683 icnt <- HashMap.size <$> readTVar (trampolineIds onionRouter)
684 rs <- getAssocs (pendingRoutes onionRouter) 684 rs <- getAssocs (pendingRoutes onionRouter)
685 pqs <- readTVar (pendingQueries onionRouter) 685 pqs <- readTVar (pendingQueries onionRouter)
686 tcp_spill <- readTVar (TCP.probeSpill $ tcpProber onionRouter)
687 tcp_cache <- readTVar (TCP.probeCache $ tcpProber onionRouter)
688 tcp_queue <- readTVar (TCP.probeQueue $ tcpProber onionRouter)
686 let showRecord :: Int -> Int -> [String] 689 let showRecord :: Int -> Int -> [String]
687 showRecord n wanted_ver 690 showRecord n wanted_ver
688 | Just RouteRecord{responseCount,timeoutCount,routeVersion,routeBirthTime} <- IntMap.lookup n rm 691 | Just RouteRecord{responseCount,timeoutCount,routeVersion,routeBirthTime} <- IntMap.lookup n rm
@@ -694,7 +697,9 @@ clientSession s@Session{..} sock cnum h = do
694 r = map (uncurry showRecord) rs 697 r = map (uncurry showRecord) rs
695 return $ do 698 return $ do
696 hPutClientChunk h $ unlines [ "trampolines: " ++ show (IntMap.size ts,tcnt,icnt) 699 hPutClientChunk h $ unlines [ "trampolines: " ++ show (IntMap.size ts,tcnt,icnt)
697 , "pending: " ++ show (W64.size pqs) ] 700 , "pending: " ++ show (W64.size pqs)
701 , "TCP spill,cache,queue: "
702 ++ show (PSQ.size tcp_spill, PSQ.size tcp_cache, PSQ.size tcp_queue)]
698 hPutClient h $ showColumns $ ["","responses","timeouts", "age", "version"]:r 703 hPutClient h $ showColumns $ ["","responses","timeouts", "age", "version"]:r
699 704
700 ("g", s) | Just DHT{..} <- Map.lookup netname dhts 705 ("g", s) | Just DHT{..} <- Map.lookup netname dhts