summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/Network/BitTorrent/DHT/Query.hs10
1 files changed, 6 insertions, 4 deletions
diff --git a/src/Network/BitTorrent/DHT/Query.hs b/src/Network/BitTorrent/DHT/Query.hs
index 4ba88b46..48dfc15a 100644
--- a/src/Network/BitTorrent/DHT/Query.hs
+++ b/src/Network/BitTorrent/DHT/Query.hs
@@ -119,10 +119,12 @@ pingQ addr = do
119 (nid, Ping) <- queryNode addr Ping 119 (nid, Ping) <- queryNode addr Ping
120 return (NodeInfo nid addr) 120 return (NodeInfo nid addr)
121 121
122-- TODO match with expected node id 122-- TODO [robustness] match range of returned node ids with the
123findNodeQ :: Address ip => NodeId -> Iteration ip NodeInfo 123-- expected range and either filter bad nodes or discard response at
124findNodeQ nid NodeInfo {..} = do 124-- all throwing an exception
125 NodeFound closest <- FindNode nid <@> nodeAddr 125findNodeQ :: Address ip => TableKey key => key -> Iteration ip NodeInfo
126findNodeQ key NodeInfo {..} = do
127 NodeFound closest <- FindNode (toNodeId key) <@> nodeAddr
126 return $ Right closest 128 return $ Right closest
127 129
128isLeft :: Either a b -> Bool 130isLeft :: Either a b -> Bool