diff options
author | joe <joe@jerkface.net> | 2017-11-01 13:57:43 -0400 |
---|---|---|
committer | joe <joe@jerkface.net> | 2017-11-01 13:57:43 -0400 |
commit | 5e9273477eadb124ec984f0363c9e253b907d328 (patch) | |
tree | e9adf756a6f042d6a08c9d3e0435bc15233570e9 /src/Network/BitTorrent | |
parent | 9860107226e9e78c8ac82b287b4fb68262ee1c5b (diff) |
Fix some announce bugs. Still WIP.
Diffstat (limited to 'src/Network/BitTorrent')
-rw-r--r-- | src/Network/BitTorrent/MainlineDHT.hs | 14 |
1 files changed, 7 insertions, 7 deletions
diff --git a/src/Network/BitTorrent/MainlineDHT.hs b/src/Network/BitTorrent/MainlineDHT.hs index f4a5ade1..eb06564a 100644 --- a/src/Network/BitTorrent/MainlineDHT.hs +++ b/src/Network/BitTorrent/MainlineDHT.hs | |||
@@ -1013,19 +1013,19 @@ ping client addr = | |||
1013 | <$> mainlineSend (Method "ping") (\Pong -> True) (const Ping) client () addr | 1013 | <$> mainlineSend (Method "ping") (\Pong -> True) (const Ping) client () addr |
1014 | 1014 | ||
1015 | -- searchQuery :: ni -> IO (Maybe [ni], [r], tok)) | 1015 | -- searchQuery :: ni -> IO (Maybe [ni], [r], tok)) |
1016 | getNodes :: MainlineClient -> NodeId -> NodeInfo -> IO (Maybe ([NodeInfo],[NodeInfo],())) | 1016 | getNodes :: MainlineClient -> NodeId -> NodeInfo -> IO (Maybe ([NodeInfo],[NodeInfo],Maybe ())) |
1017 | getNodes = mainlineSend (Method "find_node") unwrapNodes $ flip FindNode (Just Want_Both) | 1017 | getNodes = mainlineSend (Method "find_node") unwrapNodes $ flip FindNode (Just Want_Both) |
1018 | 1018 | ||
1019 | unwrapNodes :: NodeFound -> ([NodeInfo], [NodeInfo], ()) | 1019 | unwrapNodes :: NodeFound -> ([NodeInfo], [NodeInfo], Maybe ()) |
1020 | unwrapNodes (NodeFound ns4 ns6) = (ns4++ns6, ns4++ns6,()) | 1020 | unwrapNodes (NodeFound ns4 ns6) = (ns4++ns6, ns4++ns6, Just ()) |
1021 | 1021 | ||
1022 | getPeers :: MainlineClient -> NodeId -> NodeInfo -> IO (Maybe ([NodeInfo],[PeerAddr],Token)) | 1022 | getPeers :: MainlineClient -> NodeId -> NodeInfo -> IO (Maybe ([NodeInfo],[PeerAddr],Maybe Token)) |
1023 | getPeers = mainlineSend (Method "get_peers") unwrapPeers $ flip GetPeers (Just Want_Both) . coerce | 1023 | getPeers = mainlineSend (Method "get_peers") unwrapPeers $ flip GetPeers (Just Want_Both) . coerce |
1024 | 1024 | ||
1025 | unwrapPeers :: GotPeers -> ([NodeInfo], [PeerAddr], Token) | 1025 | unwrapPeers :: GotPeers -> ([NodeInfo], [PeerAddr], Maybe Token) |
1026 | unwrapPeers (GotPeers ps (NodeFound ns4 ns6) tok) = (ns4++ns6, ps, tok) | 1026 | unwrapPeers (GotPeers ps (NodeFound ns4 ns6) tok) = (ns4++ns6, ps, Just tok) |
1027 | 1027 | ||
1028 | mainlineSearch :: (NodeId -> NodeInfo -> IO (Maybe ([NodeInfo], [r], tok))) | 1028 | mainlineSearch :: (NodeId -> NodeInfo -> IO (Maybe ([NodeInfo], [r], Maybe tok))) |
1029 | -> Search NodeId (IP, PortNumber) tok NodeInfo r | 1029 | -> Search NodeId (IP, PortNumber) tok NodeInfo r |
1030 | mainlineSearch qry = Search | 1030 | mainlineSearch qry = Search |
1031 | { searchSpace = mainlineSpace | 1031 | { searchSpace = mainlineSpace |