diff options
-rw-r--r-- | bench/Main.hs | 1 | ||||
-rw-r--r-- | network-bittorrent.cabal | 2 | ||||
-rw-r--r-- | src/Data/Bitfield.hs (renamed from src/Network/BitTorrent/PeerWire/Bitfield.hs) | 4 | ||||
-rw-r--r-- | src/Network/BitTorrent/PeerWire.hs | 1 | ||||
-rw-r--r-- | src/Network/BitTorrent/PeerWire/Message.hs | 2 | ||||
-rw-r--r-- | src/Network/BitTorrent/PeerWire/Selection.hs | 3 | ||||
-rw-r--r-- | tests/Encoding.hs | 1 | ||||
-rw-r--r-- | tests/Main.hs | 2 |
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) | |||
8 | import qualified Data.ByteString as B | 8 | import qualified Data.ByteString as B |
9 | import Data.Serialize | 9 | import Data.Serialize |
10 | import Network.BitTorrent as BT | 10 | import Network.BitTorrent as BT |
11 | import Data.Bitfield as BT | ||
11 | 12 | ||
12 | 13 | ||
13 | instance NFData BlockIx where | 14 | instance 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 | ||
23 | library | 23 | library |
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 #-} |
15 | module Network.BitTorrent.PeerWire.Bitfield | 15 | module 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 |
52 | import Data.Torrent | 52 | import 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 |
56 | newtype Bitfield = MkBitfield { | 56 | newtype 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 @@ | |||
9 | module Network.BitTorrent.PeerWire (module PW) where | 9 | module Network.BitTorrent.PeerWire (module PW) where |
10 | 10 | ||
11 | import Network.BitTorrent.PeerWire.Block as PW | 11 | import Network.BitTorrent.PeerWire.Block as PW |
12 | import Network.BitTorrent.PeerWire.Bitfield as PW | ||
13 | import Network.BitTorrent.PeerWire.Selection as PW | 12 | import Network.BitTorrent.PeerWire.Selection as PW |
14 | import Network.BitTorrent.PeerWire.Message as PW | 13 | import Network.BitTorrent.PeerWire.Message as PW |
15 | import Network.BitTorrent.PeerWire.Handshake as PW | 14 | import 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 | |||
10 | import Data.Serialize | 10 | import Data.Serialize |
11 | 11 | ||
12 | import Network.BitTorrent.PeerWire.Block | 12 | import Network.BitTorrent.PeerWire.Block |
13 | import Network.BitTorrent.PeerWire.Bitfield | 13 | import Data.Bitfield |
14 | 14 | ||
15 | import Data.Array | 15 | import 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 | ||
32 | import Data.Bitfield | ||
32 | import Network.BitTorrent.PeerWire.Block | 33 | import Network.BitTorrent.PeerWire.Block |
33 | import Network.BitTorrent.PeerWire.Message | 34 | import Network.BitTorrent.PeerWire.Message |
34 | import Network.BitTorrent.PeerWire.Bitfield | 35 | |
35 | 36 | ||
36 | 37 | ||
37 | type Selector = Bitfield -- ^ Indices of client "have" pieces. | 38 | type 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 | ||
15 | import Network.URI | 15 | import Network.URI |
16 | 16 | ||
17 | import Data.Bitfield | ||
17 | import Data.Torrent | 18 | import Data.Torrent |
18 | import Network.BitTorrent | 19 | import 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 | ||
9 | import Encoding | 9 | import Encoding |
10 | 10 | ||
11 | import Data.Bitfield as BT | ||
11 | import Network.BitTorrent as BT | 12 | import Network.BitTorrent as BT |
12 | 13 | ||
14 | |||
13 | prop_bitfieldDiff0 :: Bitfield -> Bool | 15 | prop_bitfieldDiff0 :: Bitfield -> Bool |
14 | prop_bitfieldDiff0 b = (b `difference` empty (8 * bitfieldByteCount b)) == b | 16 | prop_bitfieldDiff0 b = (b `difference` empty (8 * bitfieldByteCount b)) == b |
15 | 17 | ||