summaryrefslogtreecommitdiff
path: root/src/Network/BitTorrent/DHT/Session.hs
diff options
context:
space:
mode:
Diffstat (limited to 'src/Network/BitTorrent/DHT/Session.hs')
-rw-r--r--src/Network/BitTorrent/DHT/Session.hs5
1 files changed, 3 insertions, 2 deletions
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