summaryrefslogtreecommitdiff
path: root/src/Network/BitTorrent/Exchange/Assembler.hs
diff options
context:
space:
mode:
authorSam Truzjan <pxqr.sta@gmail.com>2013-12-14 23:26:21 +0400
committerSam Truzjan <pxqr.sta@gmail.com>2013-12-14 23:26:21 +0400
commit254a407eafe53d7d98b55a694b840f1af6fe5e75 (patch)
tree9464626052e0f05ce7e9d8b6fba147ce033d4498 /src/Network/BitTorrent/Exchange/Assembler.hs
parentc7d84e12184430062305d1d4677a90df558484ea (diff)
parent8e4419d5bf7880ac862675dc4105cf6503c488bc (diff)
Merge branch 'dev' of https://github.com/DanielG/bittorrent
Diffstat (limited to 'src/Network/BitTorrent/Exchange/Assembler.hs')
-rw-r--r--src/Network/BitTorrent/Exchange/Assembler.hs9
1 files changed, 5 insertions, 4 deletions
diff --git a/src/Network/BitTorrent/Exchange/Assembler.hs b/src/Network/BitTorrent/Exchange/Assembler.hs
index 5dc7c5ca..aa009f49 100644
--- a/src/Network/BitTorrent/Exchange/Assembler.hs
+++ b/src/Network/BitTorrent/Exchange/Assembler.hs
@@ -65,6 +65,7 @@ import Data.IntMap.Strict as IM
65import Data.List as L 65import Data.List as L
66import Data.Map as M 66import Data.Map as M
67import Data.Maybe 67import Data.Maybe
68import Data.IP
68 69
69import Data.Torrent.Piece 70import Data.Torrent.Piece
70import Network.BitTorrent.Core 71import Network.BitTorrent.Core
@@ -79,7 +80,7 @@ type PieceMap = IntMap
79 80
80data Assembler = Assembler 81data Assembler = Assembler
81 { -- | A set of blocks that have been 'Request'ed but not yet acked. 82 { -- | A set of blocks that have been 'Request'ed but not yet acked.
82 _inflight :: Map PeerAddr (PieceMap [BlockRange]) 83 _inflight :: Map (PeerAddr IP) (PieceMap [BlockRange])
83 84
84 -- | A set of blocks that but not yet assembled. 85 -- | A set of blocks that but not yet assembled.
85 , _pending :: PieceMap Bucket 86 , _pending :: PieceMap Bucket
@@ -114,7 +115,7 @@ allowPiece pix a @ Assembler {..} = over pending (IM.insert pix bkt) a
114 where 115 where
115 bkt = B.empty (piPieceLength info) 116 bkt = B.empty (piPieceLength info)
116 117
117allowedSet :: PeerAddr -> Assembler -> [BlockIx] 118allowedSet :: (PeerAddr IP) -> Assembler -> [BlockIx]
118allowedSet = undefined 119allowedSet = undefined
119 120
120--inflight :: PeerAddr -> BlockIx -> Assembler -> Assembler 121--inflight :: PeerAddr -> BlockIx -> Assembler -> Assembler
@@ -123,7 +124,7 @@ allowedSet = undefined
123-- You should check if a returned by peer block is actually have 124-- You should check if a returned by peer block is actually have
124-- been requested and in-flight. This is needed to avoid "I send 125-- been requested and in-flight. This is needed to avoid "I send
125-- random corrupted block" attacks. 126-- random corrupted block" attacks.
126insert :: PeerAddr -> Block a -> Assembler -> Assembler 127insert :: (PeerAddr IP) -> Block a -> Assembler -> Assembler
127insert = undefined 128insert = undefined
128 129
129{- 130{-
@@ -156,4 +157,4 @@ inserta :: Block a
156 -> (PieceMap [Block a], Maybe (Piece a)) 157 -> (PieceMap [Block a], Maybe (Piece a))
157inserta = undefined 158inserta = undefined
158 159
159-} \ No newline at end of file 160-}