summaryrefslogtreecommitdiff
path: root/src/Network/BitTorrent/DHT
diff options
context:
space:
mode:
Diffstat (limited to 'src/Network/BitTorrent/DHT')
-rw-r--r--src/Network/BitTorrent/DHT/Query.hs2
-rw-r--r--src/Network/BitTorrent/DHT/Session.hs5
2 files changed, 4 insertions, 3 deletions
diff --git a/src/Network/BitTorrent/DHT/Query.hs b/src/Network/BitTorrent/DHT/Query.hs
index ac53bd91..cb7d5c5f 100644
--- a/src/Network/BitTorrent/DHT/Query.hs
+++ b/src/Network/BitTorrent/DHT/Query.hs
@@ -160,7 +160,7 @@ search k action = do
160 $(logWarnS) "search" "start query" 160 $(logWarnS) "search" "start query"
161 responses <- lift $ queryParallel (action <$> batch) 161 responses <- lift $ queryParallel (action <$> batch)
162 let (nodes, results) = partitionEithers responses 162 let (nodes, results) = partitionEithers responses
163 $(logWarnS) "search" "done query" 163 $(logWarnS) "search" ("done query more:" <> T.pack (show $ L.length nodes))
164 leftover $ L.concat nodes 164 leftover $ L.concat nodes
165 mapM_ yield results 165 mapM_ yield results
166 166
diff --git a/src/Network/BitTorrent/DHT/Session.hs b/src/Network/BitTorrent/DHT/Session.hs
index 9aa25866..38b3ed11 100644
--- a/src/Network/BitTorrent/DHT/Session.hs
+++ b/src/Network/BitTorrent/DHT/Session.hs
@@ -299,8 +299,9 @@ newNode :: Address ip
299 -> Options -- ^ various dht options; 299 -> Options -- ^ various dht options;
300 -> NodeAddr ip -- ^ node address to bind; 300 -> NodeAddr ip -- ^ node address to bind;
301 -> LogFun -- ^ 301 -> LogFun -- ^
302 -> Maybe NodeId -- ^ use this NodeId, if not given a new one is generated.
302 -> IO (Node ip) -- ^ a new DHT node running at given address. 303 -> IO (Node ip) -- ^ a new DHT node running at given address.
303newNode hs opts naddr logger = do 304newNode hs opts naddr logger mbid = do
304 s <- createInternalState 305 s <- createInternalState
305 runInternalState initNode s 306 runInternalState initNode s
306 `onException` closeInternalState s 307 `onException` closeInternalState s
@@ -311,7 +312,7 @@ newNode hs opts naddr logger = do
311 s <- getInternalState 312 s <- getInternalState
312 (_, m) <- allocate (newManager rpcOpts nodeAddr hs) closeManager 313 (_, m) <- allocate (newManager rpcOpts nodeAddr hs) closeManager
313 liftIO $ do 314 liftIO $ do
314 myId <- genNodeId 315 myId <- maybe genNodeId return mbid
315 node <- Node opts myId s m 316 node <- Node opts myId s m
316 <$> newMVar (nullTable myId (optBucketCount opts)) 317 <$> newMVar (nullTable myId (optBucketCount opts))
317 <*> newTVarIO def 318 <*> newTVarIO def