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.hs15
1 files changed, 4 insertions, 11 deletions
diff --git a/src/Network/BitTorrent/DHT/Session.hs b/src/Network/BitTorrent/DHT/Session.hs
index 44a5f0e9..d9a50a15 100644
--- a/src/Network/BitTorrent/DHT/Session.hs
+++ b/src/Network/BitTorrent/DHT/Session.hs
@@ -66,9 +66,7 @@ module Network.BitTorrent.DHT.Session
66 66
67import Prelude hiding (ioError) 67import Prelude hiding (ioError)
68 68
69import Control.Applicative
70import Control.Concurrent.STM 69import Control.Concurrent.STM
71import Control.Concurrent.Lifted hiding (yield)
72import Control.Concurrent.Async.Lifted 70import Control.Concurrent.Async.Lifted
73import Control.Exception.Lifted hiding (Handler) 71import Control.Exception.Lifted hiding (Handler)
74import Control.Monad.Base 72import Control.Monad.Base
@@ -82,16 +80,10 @@ import Data.Fixed
82import Data.Hashable 80import Data.Hashable
83import Data.List as L 81import Data.List as L
84import Data.Maybe 82import Data.Maybe
85import Data.Monoid
86import Data.Set as S 83import Data.Set as S
87import Data.Text as T
88import Data.Time 84import Data.Time
89import Data.Time.Clock.POSIX
90import Network (PortNumber) 85import Network (PortNumber)
91import System.Log.FastLogger
92import System.Random (randomIO) 86import System.Random (randomIO)
93import Text.PrettyPrint as PP hiding ((<>), ($$))
94import Text.PrettyPrint.HughesPJClass hiding ((<>),($$))
95 87
96import Data.Torrent as Torrent 88import Data.Torrent as Torrent
97import Network.KRPC as KRPC hiding (Options, def) 89import Network.KRPC as KRPC hiding (Options, def)
@@ -118,7 +110,7 @@ defaultAlpha = 3
118 110
119-- TODO do not insert infohash -> peeraddr if infohash is too far from 111-- TODO do not insert infohash -> peeraddr if infohash is too far from
120-- this node id 112-- this node id
121 113{-
122data Order 114data Order
123 = NearFirst 115 = NearFirst
124 | FarFirst 116 | FarFirst
@@ -127,6 +119,7 @@ data Order
127data Traversal 119data Traversal
128 = Greedy -- ^ aggressive short-circuit traversal 120 = Greedy -- ^ aggressive short-circuit traversal
129 | Exhaustive -- ^ 121 | Exhaustive -- ^
122-}
130 123
131-- | Original Kamelia DHT uses term /publish/ for data replication 124-- | Original Kamelia DHT uses term /publish/ for data replication
132-- process. BitTorrent DHT uses term /announce/ since the purpose of 125-- process. BitTorrent DHT uses term /announce/ since the purpose of
@@ -460,11 +453,11 @@ deleteTopic ih p = do
460-- Messaging 453-- Messaging
461-----------------------------------------------------------------------} 454-----------------------------------------------------------------------}
462 455
463-- TODO: use alpha
464-- | Failed queries are ignored. 456-- | Failed queries are ignored.
465queryParallel :: [DHT ip a] -> DHT ip [a] 457queryParallel :: [DHT ip a] -> DHT ip [a]
466queryParallel queries = do 458queryParallel queries = do
467 alpha <- asks (optAlpha . options) 459 -- TODO: use alpha
460 -- alpha <- asks (optAlpha . options)
468 cleanup <$> mapConcurrently try queries 461 cleanup <$> mapConcurrently try queries
469 where 462 where
470 cleanup :: [Either QueryFailure a] -> [a] 463 cleanup :: [Either QueryFailure a] -> [a]