summaryrefslogtreecommitdiff
path: root/examples/dhtd.hs
diff options
context:
space:
mode:
authorJoe Crayne <joe@jerkface.net>2018-12-12 02:01:39 -0500
committerJoe Crayne <joe@jerkface.net>2018-12-16 14:08:26 -0500
commitd96234b9954fb2e41521eb437edf2fee7317f7d6 (patch)
tree7a97ad1a7b4d01f1c9d74dcb93fae29d075bb76c /examples/dhtd.hs
parent1819d80705986d36c3264f60d05a5383c73bc33f (diff)
TCP Prober.
Diffstat (limited to 'examples/dhtd.hs')
-rw-r--r--examples/dhtd.hs6
1 files changed, 4 insertions, 2 deletions
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
97import qualified Network.Tox.Onion.Handlers as Tox 97import qualified Network.Tox.Onion.Handlers as Tox
98import qualified Network.Tox.Crypto.Transport as Tox 98import qualified Network.Tox.Crypto.Transport as Tox
99import qualified Network.Tox.TCP as TCP 99import qualified Network.Tox.TCP as TCP
100import qualified TCPProber as TCP
100import Data.Typeable 101import Data.Typeable
101import Network.Tox.ContactInfo as Tox 102import Network.Tox.ContactInfo as Tox
102import OnionRouter 103import OnionRouter
@@ -1490,6 +1491,7 @@ initTox opts ssvar keysdb mbxmpp invc = case porttox opts of
1490 Want_IP4 -> toxStrap4 1491 Want_IP4 -> toxStrap4
1491 Want_IP6 -> toxStrap6 1492 Want_IP6 -> toxStrap6
1492 } 1493 }
1494 tcpprober = tcpProber $ Tox.toxOnionRoutes tox
1493 tcpclient = tcpKademliaClient $ Tox.toxOnionRoutes tox 1495 tcpclient = tcpKademliaClient $ Tox.toxOnionRoutes tox
1494 tcpRefresher = tcpBucketRefresher $ Tox.toxOnionRoutes tox 1496 tcpRefresher = tcpBucketRefresher $ Tox.toxOnionRoutes tox
1495 tcpDHT = DHT 1497 tcpDHT = DHT
@@ -1500,9 +1502,9 @@ initTox opts ssvar keysdb mbxmpp invc = case porttox opts of
1500 , pingShowResult = show 1502 , pingShowResult = show
1501 } 1503 }
1502 , dhtQuery = Map.singleton "node" DHTQuery 1504 , dhtQuery = Map.singleton "node" DHTQuery
1503 { qsearch = TCP.nodeSearch tcpclient 1505 { qsearch = TCP.nodeSearch tcpprober tcpclient
1504 , qhandler = \ni nid -> do 1506 , qhandler = \ni nid -> do
1505 ns <- R.kclosest (searchSpace $ TCP.nodeSearch tcpclient) searchK nid 1507 ns <- R.kclosest (searchSpace $ TCP.nodeSearch tcpprober tcpclient) searchK nid
1506 <$> atomically (readTVar $ refreshBuckets tcpRefresher) 1508 <$> atomically (readTVar $ refreshBuckets tcpRefresher)
1507 return (ns,ns,Just ()) 1509 return (ns,ns,Just ())
1508 , qshowR = show -- TCP.NodeInfo 1510 , qshowR = show -- TCP.NodeInfo