summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--bench/Main.hs1
-rw-r--r--network-bittorrent.cabal2
-rw-r--r--src/Data/Bitfield.hs (renamed from src/Network/BitTorrent/PeerWire/Bitfield.hs)4
-rw-r--r--src/Network/BitTorrent/PeerWire.hs1
-rw-r--r--src/Network/BitTorrent/PeerWire/Message.hs2
-rw-r--r--src/Network/BitTorrent/PeerWire/Selection.hs3
-rw-r--r--tests/Encoding.hs1
-rw-r--r--tests/Main.hs2
8 files changed, 10 insertions, 6 deletions
diff --git a/bench/Main.hs b/bench/Main.hs
index 6162eeb1..269e60f5 100644
--- a/bench/Main.hs
+++ b/bench/Main.hs
@@ -8,6 +8,7 @@ import Data.ByteString (ByteString)
8import qualified Data.ByteString as B 8import qualified Data.ByteString as B
9import Data.Serialize 9import Data.Serialize
10import Network.BitTorrent as BT 10import Network.BitTorrent as BT
11import Data.Bitfield as BT
11 12
12 13
13instance NFData BlockIx where 14instance NFData BlockIx where
diff --git a/network-bittorrent.cabal b/network-bittorrent.cabal
index e3f60869..a0df082f 100644
--- a/network-bittorrent.cabal
+++ b/network-bittorrent.cabal
@@ -22,6 +22,7 @@ source-repository head
22 22
23library 23library
24 exposed-modules: Data.Torrent 24 exposed-modules: Data.Torrent
25 , Data.Bitfield
25 , Data.Torrent.InfoHash 26 , Data.Torrent.InfoHash
26 27
27 , Network.BitTorrent 28 , Network.BitTorrent
@@ -37,7 +38,6 @@ library
37 38
38 , Network.BitTorrent.PeerWire 39 , Network.BitTorrent.PeerWire
39 , Network.BitTorrent.PeerWire.Block 40 , Network.BitTorrent.PeerWire.Block
40 , Network.BitTorrent.PeerWire.Bitfield
41 , Network.BitTorrent.PeerWire.Selection 41 , Network.BitTorrent.PeerWire.Selection
42 , Network.BitTorrent.PeerWire.Message 42 , Network.BitTorrent.PeerWire.Message
43 , Network.BitTorrent.PeerWire.Handshake 43 , Network.BitTorrent.PeerWire.Handshake
diff --git a/src/Network/BitTorrent/PeerWire/Bitfield.hs b/src/Data/Bitfield.hs
index 03273899..ac647791 100644
--- a/src/Network/BitTorrent/PeerWire/Bitfield.hs
+++ b/src/Data/Bitfield.hs
@@ -12,7 +12,7 @@
12-- 12--
13{-# LANGUAGE BangPatterns #-} 13{-# LANGUAGE BangPatterns #-}
14{-# LANGUAGE RankNTypes #-} 14{-# LANGUAGE RankNTypes #-}
15module Network.BitTorrent.PeerWire.Bitfield 15module Data.Bitfield
16-- TODO: move to Data.Bitfield 16-- TODO: move to Data.Bitfield
17 ( Bitfield(..) 17 ( Bitfield(..)
18 18
@@ -51,7 +51,7 @@ import Foreign
51--import Network.BitTorrent.PeerWire.Block 51--import Network.BitTorrent.PeerWire.Block
52import Data.Torrent 52import Data.Torrent
53 53
54-- one good idea is to aggregate frequently used stats in reducer 54-- TODO: one good idea is to aggregate frequently used stats in reducer
55-- it should give a big boost 55-- it should give a big boost
56newtype Bitfield = MkBitfield { 56newtype Bitfield = MkBitfield {
57 bfBits :: ByteString 57 bfBits :: ByteString
diff --git a/src/Network/BitTorrent/PeerWire.hs b/src/Network/BitTorrent/PeerWire.hs
index 6d8ff156..d0583bff 100644
--- a/src/Network/BitTorrent/PeerWire.hs
+++ b/src/Network/BitTorrent/PeerWire.hs
@@ -9,7 +9,6 @@
9module Network.BitTorrent.PeerWire (module PW) where 9module Network.BitTorrent.PeerWire (module PW) where
10 10
11import Network.BitTorrent.PeerWire.Block as PW 11import Network.BitTorrent.PeerWire.Block as PW
12import Network.BitTorrent.PeerWire.Bitfield as PW
13import Network.BitTorrent.PeerWire.Selection as PW 12import Network.BitTorrent.PeerWire.Selection as PW
14import Network.BitTorrent.PeerWire.Message as PW 13import Network.BitTorrent.PeerWire.Message as PW
15import Network.BitTorrent.PeerWire.Handshake as PW 14import Network.BitTorrent.PeerWire.Handshake as PW
diff --git a/src/Network/BitTorrent/PeerWire/Message.hs b/src/Network/BitTorrent/PeerWire/Message.hs
index cc771966..39102eed 100644
--- a/src/Network/BitTorrent/PeerWire/Message.hs
+++ b/src/Network/BitTorrent/PeerWire/Message.hs
@@ -10,7 +10,7 @@ import qualified Data.ByteString as B
10import Data.Serialize 10import Data.Serialize
11 11
12import Network.BitTorrent.PeerWire.Block 12import Network.BitTorrent.PeerWire.Block
13import Network.BitTorrent.PeerWire.Bitfield 13import Data.Bitfield
14 14
15import Data.Array 15import Data.Array
16 16
diff --git a/src/Network/BitTorrent/PeerWire/Selection.hs b/src/Network/BitTorrent/PeerWire/Selection.hs
index 2e17317e..83ab8311 100644
--- a/src/Network/BitTorrent/PeerWire/Selection.hs
+++ b/src/Network/BitTorrent/PeerWire/Selection.hs
@@ -29,9 +29,10 @@ module Network.BitTorrent.PeerWire.Selection
29 , autoSelector 29 , autoSelector
30 ) where 30 ) where
31 31
32import Data.Bitfield
32import Network.BitTorrent.PeerWire.Block 33import Network.BitTorrent.PeerWire.Block
33import Network.BitTorrent.PeerWire.Message 34import Network.BitTorrent.PeerWire.Message
34import Network.BitTorrent.PeerWire.Bitfield 35
35 36
36 37
37type Selector = Bitfield -- ^ Indices of client "have" pieces. 38type Selector = Bitfield -- ^ Indices of client "have" pieces.
diff --git a/tests/Encoding.hs b/tests/Encoding.hs
index bd452975..fe0e1d7e 100644
--- a/tests/Encoding.hs
+++ b/tests/Encoding.hs
@@ -14,6 +14,7 @@ import Test.QuickCheck
14 14
15import Network.URI 15import Network.URI
16 16
17import Data.Bitfield
17import Data.Torrent 18import Data.Torrent
18import Network.BitTorrent 19import Network.BitTorrent
19 20
diff --git a/tests/Main.hs b/tests/Main.hs
index 5a9a50ee..ff3d8260 100644
--- a/tests/Main.hs
+++ b/tests/Main.hs
@@ -8,8 +8,10 @@ import Test.Framework.Providers.QuickCheck2 (testProperty)
8 8
9import Encoding 9import Encoding
10 10
11import Data.Bitfield as BT
11import Network.BitTorrent as BT 12import Network.BitTorrent as BT
12 13
14
13prop_bitfieldDiff0 :: Bitfield -> Bool 15prop_bitfieldDiff0 :: Bitfield -> Bool
14prop_bitfieldDiff0 b = (b `difference` empty (8 * bitfieldByteCount b)) == b 16prop_bitfieldDiff0 b = (b `difference` empty (8 * bitfieldByteCount b)) == b
15 17