summaryrefslogtreecommitdiff
path: root/src/Network/BitTorrent/Exchange
diff options
context:
space:
mode:
Diffstat (limited to 'src/Network/BitTorrent/Exchange')
-rw-r--r--src/Network/BitTorrent/Exchange/Session/Metadata.hs5
1 files changed, 3 insertions, 2 deletions
diff --git a/src/Network/BitTorrent/Exchange/Session/Metadata.hs b/src/Network/BitTorrent/Exchange/Session/Metadata.hs
index 174550fa..5d72172a 100644
--- a/src/Network/BitTorrent/Exchange/Session/Metadata.hs
+++ b/src/Network/BitTorrent/Exchange/Session/Metadata.hs
@@ -21,6 +21,7 @@ import Control.Monad.State
21import Data.ByteString as BS 21import Data.ByteString as BS
22import Data.ByteString.Lazy as BL 22import Data.ByteString.Lazy as BL
23import Data.List as L 23import Data.List as L
24import Data.Tuple
24 25
25import Data.BEncode as BE 26import Data.BEncode as BE
26import Data.Torrent 27import Data.Torrent
@@ -45,7 +46,7 @@ nullStatus ps = Status [] (Block.empty ps)
45type Updates a = State Status a 46type Updates a = State Status a
46 47
47runUpdates :: MVar Status -> Updates a -> IO a 48runUpdates :: MVar Status -> Updates a -> IO a
48runUpdates v m = undefined 49runUpdates v m = modifyMVar v (return . swap . runState m)
49 50
50scheduleBlock :: PeerAddr IP -> Updates (Maybe PieceIx) 51scheduleBlock :: PeerAddr IP -> Updates (Maybe PieceIx)
51scheduleBlock addr = do 52scheduleBlock addr = do
@@ -53,7 +54,7 @@ scheduleBlock addr = do
53 case spans metadataPieceSize bkt of 54 case spans metadataPieceSize bkt of
54 [] -> return Nothing 55 [] -> return Nothing
55 ((off, _ ) : _) -> do 56 ((off, _ ) : _) -> do
56 let pix = undefined 57 let pix = off `div` metadataPieceSize
57 pending %= ((addr, pix) :) 58 pending %= ((addr, pix) :)
58 return (Just pix) 59 return (Just pix)
59 60