diff options
author | Joe Crayne <joe@jerkface.net> | 2018-06-28 19:22:00 -0400 |
---|---|---|
committer | Joe Crayne <joe@jerkface.net> | 2018-06-28 19:23:14 -0400 |
commit | 8b817ae44034b5a0740df369c002e8953a530840 (patch) | |
tree | b8b8bac5d75d3421b22d861b8c95d8394e6eeebb /examples/dhtd.hs | |
parent | 8ff122d2d381fc9b1dd5c16067fba19f89512261 (diff) |
More performant pendingRoutes (IntMap -> Array).
Diffstat (limited to 'examples/dhtd.hs')
-rw-r--r-- | examples/dhtd.hs | 4 |
1 files changed, 2 insertions, 2 deletions
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 | |||
935 | ts <- readTVar $ trampolineNodes onionRouter | 935 | ts <- readTVar $ trampolineNodes onionRouter |
936 | tcnt <- readTVar $ trampolineCount onionRouter | 936 | tcnt <- readTVar $ trampolineCount onionRouter |
937 | icnt <- HashMap.size <$> readTVar (trampolineIds onionRouter) | 937 | icnt <- HashMap.size <$> readTVar (trampolineIds onionRouter) |
938 | rs <- mapM readTVar (pendingRoutes onionRouter) | 938 | rs <- getAssocs (pendingRoutes onionRouter) |
939 | pqs <- readTVar (pendingQueries onionRouter) | 939 | pqs <- readTVar (pendingQueries onionRouter) |
940 | let showRecord :: Int -> Int -> [String] | 940 | let showRecord :: Int -> Int -> [String] |
941 | showRecord n wanted_ver | 941 | showRecord n wanted_ver |
@@ -945,7 +945,7 @@ clientSession s@Session{..} sock cnum h = do | |||
945 | then show routeVersion | 945 | then show routeVersion |
946 | else show routeVersion ++ "(pending)" ] | 946 | else show routeVersion ++ "(pending)" ] |
947 | | otherwise = [show n, "error!","","",""] | 947 | | otherwise = [show n, "error!","","",""] |
948 | r = map (uncurry showRecord) $ IntMap.toAscList rs | 948 | r = map (uncurry showRecord) rs |
949 | return $ do | 949 | return $ do |
950 | hPutClientChunk h $ unlines [ "trampolines: " ++ show (IntMap.size ts,tcnt,icnt) | 950 | hPutClientChunk h $ unlines [ "trampolines: " ++ show (IntMap.size ts,tcnt,icnt) |
951 | , "pending: " ++ show (W64.size pqs) ] | 951 | , "pending: " ++ show (W64.size pqs) ] |