summaryrefslogtreecommitdiff
path: root/src/Network/BitTorrent/MainlineDHT.hs
diff options
context:
space:
mode:
authorjoe <joe@jerkface.net>2017-11-07 23:58:28 -0500
committerjoe <joe@jerkface.net>2017-11-08 02:30:43 -0500
commit65a2d2fbeee67dc400f683eaedf88153f0ba9bab (patch)
tree093426196ec7d65c3fc3509b5807161daffb185c /src/Network/BitTorrent/MainlineDHT.hs
parent83650b62724ae8deb90fc4659b3ead47d25ead53 (diff)
dhtBootstrap
Diffstat (limited to 'src/Network/BitTorrent/MainlineDHT.hs')
-rw-r--r--src/Network/BitTorrent/MainlineDHT.hs9
1 files changed, 7 insertions, 2 deletions
diff --git a/src/Network/BitTorrent/MainlineDHT.hs b/src/Network/BitTorrent/MainlineDHT.hs
index 3e7a0eda..47d5b3e1 100644
--- a/src/Network/BitTorrent/MainlineDHT.hs
+++ b/src/Network/BitTorrent/MainlineDHT.hs
@@ -538,7 +538,12 @@ mkNodeInfo nid addr = NodeInfo
538 , nodePort = fromMaybe 0 $ sockAddrPort addr 538 , nodePort = fromMaybe 0 $ sockAddrPort addr
539 } 539 }
540 540
541newClient :: SwarmsDatabase -> SockAddr -> IO (MainlineClient, Routing) 541newClient :: SwarmsDatabase -> SockAddr
542 -> IO ( MainlineClient
543 , Routing
544 , [NodeInfo] -> [NodeInfo] -> IO ()
545 , [NodeInfo] -> [NodeInfo] -> IO ()
546 )
542newClient swarms addr = do 547newClient swarms addr = do
543 udp <- udpTransport addr 548 udp <- udpTransport addr
544 nid <- NodeId <$> getRandomBytes 20 549 nid <- NodeId <$> getRandomBytes 20
@@ -651,7 +656,7 @@ newClient swarms addr = do
651 refresh_thread4 <- forkPollForRefresh $ refresher4 routing 656 refresh_thread4 <- forkPollForRefresh $ refresher4 routing
652 refresh_thread6 <- forkPollForRefresh $ refresher6 routing 657 refresh_thread6 <- forkPollForRefresh $ refresher6 routing
653 658
654 return (client, routing) 659 return (client, routing, bootstrap (refresher4 routing), bootstrap (refresher6 routing))
655 660
656-- | Modifies a purely random 'NodeId' to one that is related to a given 661-- | Modifies a purely random 'NodeId' to one that is related to a given
657-- routable address in accordance with BEP 42. 662-- routable address in accordance with BEP 42.