diff options
author | Joe Crayne <joe@jerkface.net> | 2018-12-13 18:42:36 -0500 |
---|---|---|
committer | Joe Crayne <joe@jerkface.net> | 2018-12-16 14:08:27 -0500 |
commit | 3f6a96450f5bac81d9ef929a3feeffb0260e363e (patch) | |
tree | eb774a295d4221837302e1421cb2c60260dd4af2 /examples | |
parent | a1ed3d4d5440e57e5b7336bb131907eacc593c9b (diff) |
Maintain a separate TCP-capable trampoline set for onion routing.
Diffstat (limited to 'examples')
-rw-r--r-- | examples/dhtd.hs | 13 |
1 files changed, 9 insertions, 4 deletions
diff --git a/examples/dhtd.hs b/examples/dhtd.hs index e4e32f28..163226cb 100644 --- a/examples/dhtd.hs +++ b/examples/dhtd.hs | |||
@@ -678,9 +678,13 @@ clientSession s@Session{..} sock cnum h = do | |||
678 | now <- getPOSIXTime | 678 | now <- getPOSIXTime |
679 | join $ atomically $ do | 679 | join $ atomically $ do |
680 | rm <- IntMap.fromList . catMaybes . map (\(i,m) -> fmap (i,) m) <$> getAssocs (routeMap onionRouter) | 680 | rm <- IntMap.fromList . catMaybes . map (\(i,m) -> fmap (i,) m) <$> getAssocs (routeMap onionRouter) |
681 | ts <- readTVar $ trampolineNodes onionRouter | 681 | let trampstate t = do |
682 | tcnt <- readTVar $ trampolineCount onionRouter | 682 | ts <- readTVar $ setNodes t |
683 | icnt <- HashMap.size <$> readTVar (trampolineIds onionRouter) | 683 | tcnt <- readTVar $ setCount t |
684 | icnt <- HashMap.size <$> readTVar (setIDs t) | ||
685 | return (ts,tcnt,icnt) | ||
686 | (ts,tcnt,icnt) <- trampstate (trampolinesUDP onionRouter) | ||
687 | (tts,ttcnt,ticnt) <- trampstate (trampolinesTCP onionRouter) | ||
684 | rs <- getAssocs (pendingRoutes onionRouter) | 688 | rs <- getAssocs (pendingRoutes onionRouter) |
685 | pqs <- readTVar (pendingQueries onionRouter) | 689 | pqs <- readTVar (pendingQueries onionRouter) |
686 | tcp_spill <- readTVar (TCP.probeSpill $ tcpProber onionRouter) | 690 | tcp_spill <- readTVar (TCP.probeSpill $ tcpProber onionRouter) |
@@ -696,7 +700,8 @@ clientSession s@Session{..} sock cnum h = do | |||
696 | | otherwise = [show n, "error!","","",""] | 700 | | otherwise = [show n, "error!","","",""] |
697 | r = map (uncurry showRecord) rs | 701 | r = map (uncurry showRecord) rs |
698 | return $ do | 702 | return $ do |
699 | hPutClientChunk h $ unlines [ "trampolines: " ++ show (IntMap.size ts,tcnt,icnt) | 703 | hPutClientChunk h $ unlines [ "trampolines(UDP): " ++ show (IntMap.size ts,tcnt,icnt) |
704 | , "trampolines(TCP): " ++ show (IntMap.size tts,ttcnt,ticnt) | ||
700 | , "pending: " ++ show (W64.size pqs) | 705 | , "pending: " ++ show (W64.size pqs) |
701 | , "TCP spill,cache,queue: " | 706 | , "TCP spill,cache,queue: " |
702 | ++ show (PSQ.size tcp_spill, PSQ.size tcp_cache, PSQ.size tcp_queue)] | 707 | ++ show (PSQ.size tcp_spill, PSQ.size tcp_cache, PSQ.size tcp_queue)] |