diff options
Diffstat (limited to 'src/Network/BitTorrent.hs')
-rw-r--r-- | src/Network/BitTorrent.hs | 12 |
1 files changed, 10 insertions, 2 deletions
diff --git a/src/Network/BitTorrent.hs b/src/Network/BitTorrent.hs index b97db4b0..86c7802b 100644 --- a/src/Network/BitTorrent.hs +++ b/src/Network/BitTorrent.hs | |||
@@ -33,8 +33,15 @@ module Network.BitTorrent | |||
33 | , SessionCount | 33 | , SessionCount |
34 | , getSessionCount | 34 | , getSessionCount |
35 | 35 | ||
36 | -- * Storage | ||
37 | , Storage | ||
38 | , bindTo | ||
39 | , unbind | ||
40 | |||
36 | -- * Discovery | 41 | -- * Discovery |
37 | , discover | 42 | , discover |
43 | , exchange | ||
44 | |||
38 | 45 | ||
39 | -- * Peer to Peer | 46 | -- * Peer to Peer |
40 | , P2P | 47 | , P2P |
@@ -122,12 +129,13 @@ discover swarm action = do | |||
122 | -- \---------------------------/ | 129 | -- \---------------------------/ |
123 | -- | 130 | -- |
124 | 131 | ||
132 | |||
125 | -- | Default P2P action. | 133 | -- | Default P2P action. |
126 | exchange :: Storage -> P2P () | 134 | exchange :: Storage -> P2P () |
127 | exchange storage = handleEvent handler | 135 | exchange storage = handleEvent (\msg -> liftIO (print msg) >> handler msg) |
128 | where | 136 | where |
129 | handler (Available bf) | 137 | handler (Available bf) |
130 | | Just m <- findMin bf = return (Want (BlockIx m 0 10)) | 138 | | Just m <- findMin bf = return (Want (BlockIx m 0 262144)) |
131 | | otherwise = error "impossible" | 139 | | otherwise = error "impossible" |
132 | -- TODO findMin :: Bitfield -> PieceIx | 140 | -- TODO findMin :: Bitfield -> PieceIx |
133 | 141 | ||