summaryrefslogtreecommitdiff
path: root/src/Network/BitTorrent
diff options
context:
space:
mode:
authorjoe <joe@jerkface.net>2017-11-01 13:57:43 -0400
committerjoe <joe@jerkface.net>2017-11-01 13:57:43 -0400
commit5e9273477eadb124ec984f0363c9e253b907d328 (patch)
treee9adf756a6f042d6a08c9d3e0435bc15233570e9 /src/Network/BitTorrent
parent9860107226e9e78c8ac82b287b4fb68262ee1c5b (diff)
Fix some announce bugs. Still WIP.
Diffstat (limited to 'src/Network/BitTorrent')
-rw-r--r--src/Network/BitTorrent/MainlineDHT.hs14
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))
1016getNodes :: MainlineClient -> NodeId -> NodeInfo -> IO (Maybe ([NodeInfo],[NodeInfo],())) 1016getNodes :: MainlineClient -> NodeId -> NodeInfo -> IO (Maybe ([NodeInfo],[NodeInfo],Maybe ()))
1017getNodes = mainlineSend (Method "find_node") unwrapNodes $ flip FindNode (Just Want_Both) 1017getNodes = mainlineSend (Method "find_node") unwrapNodes $ flip FindNode (Just Want_Both)
1018 1018
1019unwrapNodes :: NodeFound -> ([NodeInfo], [NodeInfo], ()) 1019unwrapNodes :: NodeFound -> ([NodeInfo], [NodeInfo], Maybe ())
1020unwrapNodes (NodeFound ns4 ns6) = (ns4++ns6, ns4++ns6,()) 1020unwrapNodes (NodeFound ns4 ns6) = (ns4++ns6, ns4++ns6, Just ())
1021 1021
1022getPeers :: MainlineClient -> NodeId -> NodeInfo -> IO (Maybe ([NodeInfo],[PeerAddr],Token)) 1022getPeers :: MainlineClient -> NodeId -> NodeInfo -> IO (Maybe ([NodeInfo],[PeerAddr],Maybe Token))
1023getPeers = mainlineSend (Method "get_peers") unwrapPeers $ flip GetPeers (Just Want_Both) . coerce 1023getPeers = mainlineSend (Method "get_peers") unwrapPeers $ flip GetPeers (Just Want_Both) . coerce
1024 1024
1025unwrapPeers :: GotPeers -> ([NodeInfo], [PeerAddr], Token) 1025unwrapPeers :: GotPeers -> ([NodeInfo], [PeerAddr], Maybe Token)
1026unwrapPeers (GotPeers ps (NodeFound ns4 ns6) tok) = (ns4++ns6, ps, tok) 1026unwrapPeers (GotPeers ps (NodeFound ns4 ns6) tok) = (ns4++ns6, ps, Just tok)
1027 1027
1028mainlineSearch :: (NodeId -> NodeInfo -> IO (Maybe ([NodeInfo], [r], tok))) 1028mainlineSearch :: (NodeId -> NodeInfo -> IO (Maybe ([NodeInfo], [r], Maybe tok)))
1029 -> Search NodeId (IP, PortNumber) tok NodeInfo r 1029 -> Search NodeId (IP, PortNumber) tok NodeInfo r
1030mainlineSearch qry = Search 1030mainlineSearch qry = Search
1031 { searchSpace = mainlineSpace 1031 { searchSpace = mainlineSpace