From d96234b9954fb2e41521eb437edf2fee7317f7d6 Mon Sep 17 00:00:00 2001 From: Joe Crayne Date: Wed, 12 Dec 2018 02:01:39 -0500 Subject: TCP Prober. --- examples/dhtd.hs | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) (limited to 'examples/dhtd.hs') diff --git a/examples/dhtd.hs b/examples/dhtd.hs index 959383dc..1223edc8 100644 --- a/examples/dhtd.hs +++ b/examples/dhtd.hs @@ -97,6 +97,7 @@ import qualified Network.Tox.Onion.Transport as Tox import qualified Network.Tox.Onion.Handlers as Tox import qualified Network.Tox.Crypto.Transport as Tox import qualified Network.Tox.TCP as TCP +import qualified TCPProber as TCP import Data.Typeable import Network.Tox.ContactInfo as Tox import OnionRouter @@ -1490,6 +1491,7 @@ initTox opts ssvar keysdb mbxmpp invc = case porttox opts of Want_IP4 -> toxStrap4 Want_IP6 -> toxStrap6 } + tcpprober = tcpProber $ Tox.toxOnionRoutes tox tcpclient = tcpKademliaClient $ Tox.toxOnionRoutes tox tcpRefresher = tcpBucketRefresher $ Tox.toxOnionRoutes tox tcpDHT = DHT @@ -1500,9 +1502,9 @@ initTox opts ssvar keysdb mbxmpp invc = case porttox opts of , pingShowResult = show } , dhtQuery = Map.singleton "node" DHTQuery - { qsearch = TCP.nodeSearch tcpclient + { qsearch = TCP.nodeSearch tcpprober tcpclient , qhandler = \ni nid -> do - ns <- R.kclosest (searchSpace $ TCP.nodeSearch tcpclient) searchK nid + ns <- R.kclosest (searchSpace $ TCP.nodeSearch tcpprober tcpclient) searchK nid <$> atomically (readTVar $ refreshBuckets tcpRefresher) return (ns,ns,Just ()) , qshowR = show -- TCP.NodeInfo -- cgit v1.2.3