diff options
Diffstat (limited to 'src/Network/BitTorrent/DHT/Session.hs')
-rw-r--r-- | src/Network/BitTorrent/DHT/Session.hs | 15 |
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 | ||
67 | import Prelude hiding (ioError) | 67 | import Prelude hiding (ioError) |
68 | 68 | ||
69 | import Control.Applicative | ||
70 | import Control.Concurrent.STM | 69 | import Control.Concurrent.STM |
71 | import Control.Concurrent.Lifted hiding (yield) | ||
72 | import Control.Concurrent.Async.Lifted | 70 | import Control.Concurrent.Async.Lifted |
73 | import Control.Exception.Lifted hiding (Handler) | 71 | import Control.Exception.Lifted hiding (Handler) |
74 | import Control.Monad.Base | 72 | import Control.Monad.Base |
@@ -82,16 +80,10 @@ import Data.Fixed | |||
82 | import Data.Hashable | 80 | import Data.Hashable |
83 | import Data.List as L | 81 | import Data.List as L |
84 | import Data.Maybe | 82 | import Data.Maybe |
85 | import Data.Monoid | ||
86 | import Data.Set as S | 83 | import Data.Set as S |
87 | import Data.Text as T | ||
88 | import Data.Time | 84 | import Data.Time |
89 | import Data.Time.Clock.POSIX | ||
90 | import Network (PortNumber) | 85 | import Network (PortNumber) |
91 | import System.Log.FastLogger | ||
92 | import System.Random (randomIO) | 86 | import System.Random (randomIO) |
93 | import Text.PrettyPrint as PP hiding ((<>), ($$)) | ||
94 | import Text.PrettyPrint.HughesPJClass hiding ((<>),($$)) | ||
95 | 87 | ||
96 | import Data.Torrent as Torrent | 88 | import Data.Torrent as Torrent |
97 | import Network.KRPC as KRPC hiding (Options, def) | 89 | import 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 | {- | |
122 | data Order | 114 | data Order |
123 | = NearFirst | 115 | = NearFirst |
124 | | FarFirst | 116 | | FarFirst |
@@ -127,6 +119,7 @@ data Order | |||
127 | data Traversal | 119 | data 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. |
465 | queryParallel :: [DHT ip a] -> DHT ip [a] | 457 | queryParallel :: [DHT ip a] -> DHT ip [a] |
466 | queryParallel queries = do | 458 | queryParallel 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] |