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.hs6
1 files changed, 3 insertions, 3 deletions
diff --git a/src/Network/BitTorrent/DHT/Session.hs b/src/Network/BitTorrent/DHT/Session.hs
index 2bb3ce85..5a8d64ef 100644
--- a/src/Network/BitTorrent/DHT/Session.hs
+++ b/src/Network/BitTorrent/DHT/Session.hs
@@ -243,7 +243,7 @@ data Node ip = Node
243 243
244 , resources :: !InternalState 244 , resources :: !InternalState
245 , manager :: !(Manager (DHT ip)) -- ^ RPC manager; 245 , manager :: !(Manager (DHT ip)) -- ^ RPC manager;
246 , routingTable :: !(MVar (Table ip)) -- ^ search table; 246 , routingTable :: !(TVar (Table ip)) -- ^ search table;
247 , contactInfo :: !(TVar (PeerStore ip)) -- ^ published by other nodes; 247 , contactInfo :: !(TVar (PeerStore ip)) -- ^ published by other nodes;
248 , announceInfo :: !(TVar AnnounceSet ) -- ^ to publish by this node; 248 , announceInfo :: !(TVar AnnounceSet ) -- ^ to publish by this node;
249 , sessionTokens :: !(TVar SessionTokens) -- ^ query session IDs. 249 , sessionTokens :: !(TVar SessionTokens) -- ^ query session IDs.
@@ -323,7 +323,7 @@ newNode hs opts naddr logger mbid = do
323 liftIO $ do 323 liftIO $ do
324 myId <- maybe genNodeId return mbid 324 myId <- maybe genNodeId return mbid
325 node <- Node opts myId s m 325 node <- Node opts myId s m
326 <$> newMVar (nullTable myId (optBucketCount opts)) 326 <$> atomically (newTVar (nullTable myId (optBucketCount opts)))
327 <*> newTVarIO def 327 <*> newTVarIO def
328 <*> newTVarIO S.empty 328 <*> newTVarIO S.empty
329 <*> (newTVarIO =<< nullSessionTokens) 329 <*> (newTVarIO =<< nullSessionTokens)
@@ -381,7 +381,7 @@ checkToken addr questionableToken = do
381getTable :: DHT ip (Table ip) 381getTable :: DHT ip (Table ip)
382getTable = do 382getTable = do
383 var <- asks routingTable 383 var <- asks routingTable
384 liftIO (readMVar var) 384 liftIO (atomically $ readTVar var)
385 385
386-- | Find a set of closest nodes from routing table of this node. (in 386-- | Find a set of closest nodes from routing table of this node. (in
387-- no particular order) 387-- no particular order)