diff options
Diffstat (limited to 'src/Network/BitTorrent/PeerWire/Block.hs')
-rw-r--r-- | src/Network/BitTorrent/PeerWire/Block.hs | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/src/Network/BitTorrent/PeerWire/Block.hs b/src/Network/BitTorrent/PeerWire/Block.hs index 582accdb..fbc65338 100644 --- a/src/Network/BitTorrent/PeerWire/Block.hs +++ b/src/Network/BitTorrent/PeerWire/Block.hs | |||
@@ -1,5 +1,7 @@ | |||
1 | module Network.BitTorrent.PeerWire.Block | 1 | module Network.BitTorrent.PeerWire.Block |
2 | ( BlockIx(..), Block(..), PieceIx | 2 | ( BlockIx(..) |
3 | , Block(..), blockSize | ||
4 | , PieceIx | ||
3 | , BlockLIx, PieceLIx | 5 | , BlockLIx, PieceLIx |
4 | , defaultBlockSize | 6 | , defaultBlockSize |
5 | , pieceIx, blockIx | 7 | , pieceIx, blockIx |
@@ -68,6 +70,9 @@ data Block = Block { | |||
68 | ppBlock :: Block -> String | 70 | ppBlock :: Block -> String |
69 | ppBlock = ppBlockIx . blockIx | 71 | ppBlock = ppBlockIx . blockIx |
70 | 72 | ||
73 | blockSize :: Block -> Int | ||
74 | blockSize blk = B.length (blkData blk) | ||
75 | |||
71 | -- | Widely used semi-official block size. | 76 | -- | Widely used semi-official block size. |
72 | defaultBlockSize :: Int | 77 | defaultBlockSize :: Int |
73 | defaultBlockSize = 16 * 1024 | 78 | defaultBlockSize = 16 * 1024 |