From 8b817ae44034b5a0740df369c002e8953a530840 Mon Sep 17 00:00:00 2001 From: Joe Crayne Date: Thu, 28 Jun 2018 19:22:00 -0400 Subject: More performant pendingRoutes (IntMap -> Array). --- examples/dhtd.hs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'examples/dhtd.hs') diff --git a/examples/dhtd.hs b/examples/dhtd.hs index 8e9e7692..7ed77d3a 100644 --- a/examples/dhtd.hs +++ b/examples/dhtd.hs @@ -935,7 +935,7 @@ clientSession s@Session{..} sock cnum h = do ts <- readTVar $ trampolineNodes onionRouter tcnt <- readTVar $ trampolineCount onionRouter icnt <- HashMap.size <$> readTVar (trampolineIds onionRouter) - rs <- mapM readTVar (pendingRoutes onionRouter) + rs <- getAssocs (pendingRoutes onionRouter) pqs <- readTVar (pendingQueries onionRouter) let showRecord :: Int -> Int -> [String] showRecord n wanted_ver @@ -945,7 +945,7 @@ clientSession s@Session{..} sock cnum h = do then show routeVersion else show routeVersion ++ "(pending)" ] | otherwise = [show n, "error!","","",""] - r = map (uncurry showRecord) $ IntMap.toAscList rs + r = map (uncurry showRecord) rs return $ do hPutClientChunk h $ unlines [ "trampolines: " ++ show (IntMap.size ts,tcnt,icnt) , "pending: " ++ show (W64.size pqs) ] -- cgit v1.2.3