summaryrefslogtreecommitdiff
path: root/dht/examples
diff options
context:
space:
mode:
authorJoe Crayne <joe@jerkface.net>2019-12-11 03:23:55 -0500
committerJoe Crayne <joe@jerkface.net>2020-01-01 23:25:07 -0500
commit44290a1b44f4b206a1eda866766d4aa11e1ae7b2 (patch)
treeb56cc635c7334d7e6055059a73caa13d1db4c7d5 /dht/examples
parent6326b4f674b4093c28a8760e53f5a81ad5747a50 (diff)
Maintain special relay links for connectivity purposes.
Diffstat (limited to 'dht/examples')
-rw-r--r--dht/examples/dhtd.hs22
1 files changed, 13 insertions, 9 deletions
diff --git a/dht/examples/dhtd.hs b/dht/examples/dhtd.hs
index 42fcc67b..0f95f562 100644
--- a/dht/examples/dhtd.hs
+++ b/dht/examples/dhtd.hs
@@ -100,6 +100,7 @@ import qualified TCPProber as TCP
100import Data.Typeable 100import Data.Typeable
101import Network.Tox.ContactInfo as Tox 101import Network.Tox.ContactInfo as Tox
102import Network.Tox.Onion.Routes 102import Network.Tox.Onion.Routes
103import Network.Tox.RelayPinger
103import qualified Data.Word64Map as W64 104import qualified Data.Word64Map as W64
104import Network.Tox.AggregateSession 105import Network.Tox.AggregateSession
105import qualified Network.Tox.Session as Tox (Session) 106import qualified Network.Tox.Session as Tox (Session)
@@ -735,16 +736,19 @@ clientSession s@Session{..} sock cnum h = do
735 | otherwise = [show n, "error!","","",""] 736 | otherwise = [show n, "error!","","",""]
736 -- otherwise = [show n, "error!",show (IntMap.lookup n rm),show (IntMap.null rm),""] 737 -- otherwise = [show n, "error!",show (IntMap.lookup n rm),show (IntMap.null rm),""]
737 r = map (uncurry showRecord) rs 738 r = map (uncurry showRecord) rs
739 (rcnt,relays) <- currentRelays (tcpRelayPinger onionRouter)
738 return $ do 740 return $ do
739 hPutClientChunk h $ unlines [ "trampolines(UDP): " ++ show (IntMap.size uts,tcnt,icnt) 741 hPutClientChunk h $ unlines
740 ++ if tcpmode then "" else " *" 742 [ "trampolines(UDP): " ++ show (IntMap.size uts,tcnt,icnt)
741 , "trampolines(TCP): " ++ show (IntMap.size tts,ttcnt,ticnt) 743 ++ if tcpmode then "" else " *"
742 ++ if tcpmode then " *" else "" 744 , "trampolines(TCP): " ++ show (IntMap.size tts,ttcnt,ticnt)
743 , "active TCP: " ++ show (MM.size tcps) 745 ++ if tcpmode then " *" else ""
744 , "pending: " ++ show (W64.size pqs) 746 , "active TCP: " ++ show (MM.size tcps)
745 , "TCP spill,cache,queue: " 747 , "pending: " ++ show (W64.size pqs)
746 ++ show (PSQ.size tcp_spill, PSQ.size tcp_cache, PSQ.size tcp_queue)] 748 , "TCP spill,cache,queue: "
747 hPutClient h $ showColumns $ ["","responses","timeouts", "tcp", "age", "version"]:r 749 ++ show (PSQ.size tcp_spill, PSQ.size tcp_cache, PSQ.size tcp_queue)]
750 hPutClientChunk h $ showColumns $ ["","responses","timeouts", "tcp", "age", "version"]:r
751 hPutClient h $ unlines $ ("relays: " ++ show rcnt) : map (mappend " " . show) relays
748 752
749 ("onion", s) | "udp" <- strp $ map toLower s 753 ("onion", s) | "udp" <- strp $ map toLower s
750 -> cmd0 $ do 754 -> cmd0 $ do