diff options
-rw-r--r-- | bittorrent.cabal | 5 | ||||
-rw-r--r-- | src/Network/BitTorrent/Client/Types.hs | 2 | ||||
-rw-r--r-- | src/Network/BitTorrent/DHT/Session.hs | 3 | ||||
-rw-r--r-- | src/Network/BitTorrent/Exchange/Connection.hs | 1 | ||||
-rw-r--r-- | tests/Network/BitTorrent/DHT/SessionSpec.hs | 1 | ||||
-rw-r--r-- | tests/Network/BitTorrent/Exchange/DownloadSpec.hs | 14 |
6 files changed, 9 insertions, 17 deletions
diff --git a/bittorrent.cabal b/bittorrent.cabal index daef3408..f970a83b 100644 --- a/bittorrent.cabal +++ b/bittorrent.cabal | |||
@@ -117,8 +117,8 @@ library | |||
117 | , stm >= 2.4 | 117 | , stm >= 2.4 |
118 | 118 | ||
119 | -- Streaming | 119 | -- Streaming |
120 | , conduit >= 1.0 | 120 | , conduit >= 1.1 |
121 | , network-conduit >= 1.0 | 121 | , conduit-extra >= 1.1 |
122 | , cereal-conduit >= 0.5 | 122 | , cereal-conduit >= 0.5 |
123 | 123 | ||
124 | -- * Logging | 124 | -- * Logging |
@@ -230,6 +230,7 @@ test-suite spec | |||
230 | , mtl | 230 | , mtl |
231 | , resourcet | 231 | , resourcet |
232 | , conduit | 232 | , conduit |
233 | , conduit-extra | ||
233 | , monad-loops | 234 | , monad-loops |
234 | , monad-logger | 235 | , monad-logger |
235 | 236 | ||
diff --git a/src/Network/BitTorrent/Client/Types.hs b/src/Network/BitTorrent/Client/Types.hs index a5bf0cce..9bae7dc3 100644 --- a/src/Network/BitTorrent/Client/Types.hs +++ b/src/Network/BitTorrent/Client/Types.hs | |||
@@ -100,7 +100,7 @@ externalAddr Client {..} = PeerAddr | |||
100 | newtype BitTorrent a = BitTorrent | 100 | newtype BitTorrent a = BitTorrent |
101 | { unBitTorrent :: ReaderT Client IO a | 101 | { unBitTorrent :: ReaderT Client IO a |
102 | } deriving ( Functor, Applicative, Monad | 102 | } deriving ( Functor, Applicative, Monad |
103 | , MonadIO, MonadThrow, MonadUnsafeIO, MonadBase IO | 103 | , MonadIO, MonadThrow, MonadBase IO |
104 | ) | 104 | ) |
105 | 105 | ||
106 | class MonadBitTorrent m where | 106 | class MonadBitTorrent m where |
diff --git a/src/Network/BitTorrent/DHT/Session.hs b/src/Network/BitTorrent/DHT/Session.hs index 0dd4b862..eab25ebb 100644 --- a/src/Network/BitTorrent/DHT/Session.hs +++ b/src/Network/BitTorrent/DHT/Session.hs | |||
@@ -75,6 +75,7 @@ import Control.Monad.Logger | |||
75 | import Control.Monad.Reader | 75 | import Control.Monad.Reader |
76 | import Control.Monad.Trans.Control | 76 | import Control.Monad.Trans.Control |
77 | import Control.Monad.Trans.Resource | 77 | import Control.Monad.Trans.Resource |
78 | import Data.Conduit.Lazy | ||
78 | import Data.Default | 79 | import Data.Default |
79 | import Data.Fixed | 80 | import Data.Fixed |
80 | import Data.Hashable | 81 | import Data.Hashable |
@@ -256,7 +257,7 @@ newtype DHT ip a = DHT { unDHT :: ReaderT (Node ip) IO a } | |||
256 | deriving ( Functor, Applicative, Monad | 257 | deriving ( Functor, Applicative, Monad |
257 | , MonadIO, MonadBase IO | 258 | , MonadIO, MonadBase IO |
258 | , MonadReader (Node ip) | 259 | , MonadReader (Node ip) |
259 | , MonadThrow, MonadUnsafeIO | 260 | , MonadThrow |
260 | ) | 261 | ) |
261 | 262 | ||
262 | instance MonadBaseControl IO (DHT ip) where | 263 | instance MonadBaseControl IO (DHT ip) where |
diff --git a/src/Network/BitTorrent/Exchange/Connection.hs b/src/Network/BitTorrent/Exchange/Connection.hs index f208fa54..2d5f39bf 100644 --- a/src/Network/BitTorrent/Exchange/Connection.hs +++ b/src/Network/BitTorrent/Exchange/Connection.hs | |||
@@ -112,6 +112,7 @@ import Control.Concurrent hiding (yield) | |||
112 | import Control.Exception | 112 | import Control.Exception |
113 | import Control.Monad.Reader | 113 | import Control.Monad.Reader |
114 | import Control.Monad.State | 114 | import Control.Monad.State |
115 | import Control.Monad.Trans.Resource | ||
115 | import Control.Lens | 116 | import Control.Lens |
116 | import Data.ByteString as BS | 117 | import Data.ByteString as BS |
117 | import Data.ByteString.Lazy as BSL | 118 | import Data.ByteString.Lazy as BSL |
diff --git a/tests/Network/BitTorrent/DHT/SessionSpec.hs b/tests/Network/BitTorrent/DHT/SessionSpec.hs index 522bd8df..a5376c32 100644 --- a/tests/Network/BitTorrent/DHT/SessionSpec.hs +++ b/tests/Network/BitTorrent/DHT/SessionSpec.hs | |||
@@ -5,6 +5,7 @@ import Control.Concurrent | |||
5 | import Control.Exception | 5 | import Control.Exception |
6 | import Control.Monad.Reader | 6 | import Control.Monad.Reader |
7 | import Control.Monad.Trans.Resource | 7 | import Control.Monad.Trans.Resource |
8 | import Data.Conduit.Lazy | ||
8 | import Data.Default | 9 | import Data.Default |
9 | import Data.List as L | 10 | import Data.List as L |
10 | import Test.Hspec | 11 | import Test.Hspec |
diff --git a/tests/Network/BitTorrent/Exchange/DownloadSpec.hs b/tests/Network/BitTorrent/Exchange/DownloadSpec.hs index a0d40af3..d46f2034 100644 --- a/tests/Network/BitTorrent/Exchange/DownloadSpec.hs +++ b/tests/Network/BitTorrent/Exchange/DownloadSpec.hs | |||
@@ -33,19 +33,7 @@ withUpdates m = do | |||
33 | undefined | 33 | undefined |
34 | 34 | ||
35 | simulateFetch :: InfoDict -> Updates s (Maybe InfoDict) | 35 | simulateFetch :: InfoDict -> Updates s (Maybe InfoDict) |
36 | simulateFetch dict = go | 36 | simulateFetch dict = undefined |
37 | where | ||
38 | blocks = chunkBy metadataPieceSize (BL.toStrict (BE.encode dict)) | ||
39 | packPiece ix = Torrent.Piece ix (blocks !! ix) | ||
40 | ih = idInfoHash dict | ||
41 | |||
42 | go = do | ||
43 | mix <- scheduleBlock undefined undefined | ||
44 | case mix of | ||
45 | Nothing -> return Nothing | ||
46 | Just ix -> do | ||
47 | mdict <- pushBlock undefined (packPiece ix) | ||
48 | maybe go (return . Just) mdict | ||
49 | 37 | ||
50 | spec :: Spec | 38 | spec :: Spec |
51 | spec = do | 39 | spec = do |