summaryrefslogtreecommitdiff
path: root/src/Network/BitTorrent/DHT/Session.hs
diff options
context:
space:
mode:
authorjoe <joe@jerkface.net>2017-06-22 01:37:04 -0400
committerjoe <joe@jerkface.net>2017-06-22 01:37:04 -0400
commite0ada56c116255a2feddcf7b09cec808f79afefc (patch)
treecf68a3015821039f707591684a237f8d7cf1c7cb /src/Network/BitTorrent/DHT/Session.hs
parent012d138b1061d967ef3a05dfb7dc819d199b3902 (diff)
Propagated MonadKRPC deletion to Network.BitTorrent.DHT.
Diffstat (limited to 'src/Network/BitTorrent/DHT/Session.hs')
-rw-r--r--src/Network/BitTorrent/DHT/Session.hs9
1 files changed, 4 insertions, 5 deletions
diff --git a/src/Network/BitTorrent/DHT/Session.hs b/src/Network/BitTorrent/DHT/Session.hs
index d8665773..d4794038 100644
--- a/src/Network/BitTorrent/DHT/Session.hs
+++ b/src/Network/BitTorrent/DHT/Session.hs
@@ -377,8 +377,8 @@ locFromCS cs = case getCallStack cs of
377-- 'closeNode' function, otherwise socket or other scarce resources may 377-- 'closeNode' function, otherwise socket or other scarce resources may
378-- leak. 378-- leak.
379newNode :: Address ip 379newNode :: Address ip
380 => [NodeHandler] -- ^ handlers to run on accepted queries; 380 => -- [NodeHandler] -- ^ handlers to run on accepted queries;
381 -> Options -- ^ various dht options; 381 Options -- ^ various dht options;
382 -> NodeAddr ip -- ^ node address to bind; 382 -> NodeAddr ip -- ^ node address to bind;
383 -> LogFun -- ^ invoked on log messages; 383 -> LogFun -- ^ invoked on log messages;
384#ifdef VERSION_bencoding 384#ifdef VERSION_bencoding
@@ -387,7 +387,7 @@ newNode :: Address ip
387 -> Maybe (NodeId Tox.Message) -- ^ use this NodeId, if not given a new one is generated. 387 -> Maybe (NodeId Tox.Message) -- ^ use this NodeId, if not given a new one is generated.
388#endif 388#endif
389 -> IO (Node ip) -- ^ a new DHT node running at given address. 389 -> IO (Node ip) -- ^ a new DHT node running at given address.
390newNode hs opts naddr logger mbid = do 390newNode opts naddr logger mbid = do
391 s <- createInternalState 391 s <- createInternalState
392 runInternalState initNode s 392 runInternalState initNode s
393 `onException` closeInternalState s 393 `onException` closeInternalState s
@@ -396,7 +396,7 @@ newNode hs opts naddr logger mbid = do
396 nodeAddr = toSockAddr naddr 396 nodeAddr = toSockAddr naddr
397 initNode = do 397 initNode = do
398 s <- getInternalState 398 s <- getInternalState
399 (_, m) <- allocate (newManager rpcOpts (logt logger) nodeAddr hs) closeManager 399 (_, m) <- allocate (newManager rpcOpts (logt logger) nodeAddr []) closeManager
400 liftIO $ do 400 liftIO $ do
401 myId <- maybe genNodeId return mbid 401 myId <- maybe genNodeId return mbid
402 node <- Node opts myId s m 402 node <- Node opts myId s m
@@ -405,7 +405,6 @@ newNode hs opts naddr logger mbid = do
405 <*> newTVarIO S.empty 405 <*> newTVarIO S.empty
406 <*> (newTVarIO =<< nullSessionTokens) 406 <*> (newTVarIO =<< nullSessionTokens)
407 <*> pure logger 407 <*> pure logger
408 KRPC.listen m (KRPC.Protocol Proxy Proxy)
409 return node 408 return node
410 409
411-- | Some resources like listener thread may live for 410-- | Some resources like listener thread may live for