diff options
author | Joe Crayne <joe@jerkface.net> | 2018-06-27 20:35:14 -0400 |
---|---|---|
committer | Joe Crayne <joe@jerkface.net> | 2018-06-27 20:35:14 -0400 |
commit | edd93b41c519ddf32ed34f495f4b9a14828d71a3 (patch) | |
tree | 8897e03592a603de71a3001e5669c5d6d31842e8 /examples/dhtd.hs | |
parent | 2305a022c97b561cadcfdfa068f6bdb182dfe7c1 (diff) |
More performant routeMap (IntMap -> Array).
Diffstat (limited to 'examples/dhtd.hs')
-rw-r--r-- | examples/dhtd.hs | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/examples/dhtd.hs b/examples/dhtd.hs index 3f2a6a63..8e9e7692 100644 --- a/examples/dhtd.hs +++ b/examples/dhtd.hs | |||
@@ -27,6 +27,7 @@ import Control.Concurrent.STM.TMChan | |||
27 | import Control.Exception | 27 | import Control.Exception |
28 | import Control.Monad | 28 | import Control.Monad |
29 | import Control.Monad.IO.Class (liftIO) | 29 | import Control.Monad.IO.Class (liftIO) |
30 | import Data.Array.MArray (getAssocs) | ||
30 | import Data.Bool | 31 | import Data.Bool |
31 | import Data.Char | 32 | import Data.Char |
32 | import Data.Conduit as C | 33 | import Data.Conduit as C |
@@ -930,7 +931,7 @@ clientSession s@Session{..} sock cnum h = do | |||
930 | ("onion", s) -> cmd0 $ do | 931 | ("onion", s) -> cmd0 $ do |
931 | now <- getPOSIXTime | 932 | now <- getPOSIXTime |
932 | join $ atomically $ do | 933 | join $ atomically $ do |
933 | rm <- readTVar $ routeMap onionRouter | 934 | rm <- IntMap.fromList . catMaybes . map (\(i,m) -> fmap (i,) m) <$> getAssocs (routeMap onionRouter) |
934 | ts <- readTVar $ trampolineNodes onionRouter | 935 | ts <- readTVar $ trampolineNodes onionRouter |
935 | tcnt <- readTVar $ trampolineCount onionRouter | 936 | tcnt <- readTVar $ trampolineCount onionRouter |
936 | icnt <- HashMap.size <$> readTVar (trampolineIds onionRouter) | 937 | icnt <- HashMap.size <$> readTVar (trampolineIds onionRouter) |