summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--bittorrent.cabal5
-rw-r--r--src/Network/BitTorrent/Client/Types.hs2
-rw-r--r--src/Network/BitTorrent/DHT/Session.hs3
-rw-r--r--src/Network/BitTorrent/Exchange/Connection.hs1
-rw-r--r--tests/Network/BitTorrent/DHT/SessionSpec.hs1
-rw-r--r--tests/Network/BitTorrent/Exchange/DownloadSpec.hs14
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
100newtype BitTorrent a = BitTorrent 100newtype 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
106class MonadBitTorrent m where 106class 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
75import Control.Monad.Reader 75import Control.Monad.Reader
76import Control.Monad.Trans.Control 76import Control.Monad.Trans.Control
77import Control.Monad.Trans.Resource 77import Control.Monad.Trans.Resource
78import Data.Conduit.Lazy
78import Data.Default 79import Data.Default
79import Data.Fixed 80import Data.Fixed
80import Data.Hashable 81import 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
262instance MonadBaseControl IO (DHT ip) where 263instance 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)
112import Control.Exception 112import Control.Exception
113import Control.Monad.Reader 113import Control.Monad.Reader
114import Control.Monad.State 114import Control.Monad.State
115import Control.Monad.Trans.Resource
115import Control.Lens 116import Control.Lens
116import Data.ByteString as BS 117import Data.ByteString as BS
117import Data.ByteString.Lazy as BSL 118import 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
5import Control.Exception 5import Control.Exception
6import Control.Monad.Reader 6import Control.Monad.Reader
7import Control.Monad.Trans.Resource 7import Control.Monad.Trans.Resource
8import Data.Conduit.Lazy
8import Data.Default 9import Data.Default
9import Data.List as L 10import Data.List as L
10import Test.Hspec 11import 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
35simulateFetch :: InfoDict -> Updates s (Maybe InfoDict) 35simulateFetch :: InfoDict -> Updates s (Maybe InfoDict)
36simulateFetch dict = go 36simulateFetch 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
50spec :: Spec 38spec :: Spec
51spec = do 39spec = do