summaryrefslogtreecommitdiff
path: root/examples/dhtd.hs
diff options
context:
space:
mode:
authorjoe <joe@jerkface.net>2018-06-09 19:59:27 -0400
committerjoe <joe@jerkface.net>2018-06-09 19:59:27 -0400
commit82f28a1161666e27adcbb0e6c383f5ac5a836495 (patch)
tree6bae86955d6dd74adb149aa10805ee4d5bac7856 /examples/dhtd.hs
parente4e4650d004cba42bfd8897d9658bfcaec82fb6d (diff)
tox: Keep tramplineIds map in sync when trampoline nodes are abandoned.
Diffstat (limited to 'examples/dhtd.hs')
-rw-r--r--examples/dhtd.hs4
1 files changed, 3 insertions, 1 deletions
diff --git a/examples/dhtd.hs b/examples/dhtd.hs
index 369650f9..fce976db 100644
--- a/examples/dhtd.hs
+++ b/examples/dhtd.hs
@@ -808,6 +808,8 @@ clientSession s@Session{..} sock cnum h = do
808 ("onion", s) -> cmd0 $ join $ atomically $ do 808 ("onion", s) -> cmd0 $ join $ atomically $ do
809 rm <- readTVar $ routeMap onionRouter 809 rm <- readTVar $ routeMap onionRouter
810 ts <- readTVar $ trampolineNodes onionRouter 810 ts <- readTVar $ trampolineNodes onionRouter
811 tcnt <- readTVar $ trampolineCount onionRouter
812 icnt <- HashMap.size <$> readTVar (trampolineIds onionRouter)
811 rs <- mapM readTVar (pendingRoutes onionRouter) 813 rs <- mapM readTVar (pendingRoutes onionRouter)
812 let showRecord :: Int -> Bool -> [String] 814 let showRecord :: Int -> Bool -> [String]
813 showRecord n True = [show n, "pending", ""] 815 showRecord n True = [show n, "pending", ""]
@@ -817,7 +819,7 @@ clientSession s@Session{..} sock cnum h = do
817 | otherwise = [show n, "error!",""] 819 | otherwise = [show n, "error!",""]
818 r = map (uncurry showRecord) $ IntMap.toAscList rs 820 r = map (uncurry showRecord) $ IntMap.toAscList rs
819 return $ do 821 return $ do
820 hPutClientChunk h $ "trampolines: " ++ show (IntMap.size ts) ++ "\n" 822 hPutClientChunk h $ "trampolines: " ++ show (IntMap.size ts,tcnt) ++ "\n"
821 hPutClient h $ showColumns $ ["","responses","timeouts"]:r 823 hPutClient h $ showColumns $ ["","responses","timeouts"]:r
822 824
823 -- necrypto <FRIEND-TOXID> 825 -- necrypto <FRIEND-TOXID>