diff options
author | joe <joe@jerkface.net> | 2017-11-07 23:58:28 -0500 |
---|---|---|
committer | joe <joe@jerkface.net> | 2017-11-08 02:30:43 -0500 |
commit | 65a2d2fbeee67dc400f683eaedf88153f0ba9bab (patch) | |
tree | 093426196ec7d65c3fc3509b5807161daffb185c /src/Network/BitTorrent | |
parent | 83650b62724ae8deb90fc4659b3ead47d25ead53 (diff) |
dhtBootstrap
Diffstat (limited to 'src/Network/BitTorrent')
-rw-r--r-- | src/Network/BitTorrent/MainlineDHT.hs | 9 |
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 | ||
541 | newClient :: SwarmsDatabase -> SockAddr -> IO (MainlineClient, Routing) | 541 | newClient :: SwarmsDatabase -> SockAddr |
542 | -> IO ( MainlineClient | ||
543 | , Routing | ||
544 | , [NodeInfo] -> [NodeInfo] -> IO () | ||
545 | , [NodeInfo] -> [NodeInfo] -> IO () | ||
546 | ) | ||
542 | newClient swarms addr = do | 547 | newClient 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. |