diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/Network/BitTorrent.hs | 2 | ||||
-rw-r--r-- | src/Network/BitTorrent/Internal.hs | 14 |
2 files changed, 9 insertions, 7 deletions
diff --git a/src/Network/BitTorrent.hs b/src/Network/BitTorrent.hs index 30735023..b6e2eadf 100644 --- a/src/Network/BitTorrent.hs +++ b/src/Network/BitTorrent.hs | |||
@@ -154,4 +154,4 @@ exchange storage = awaitEvent >>= handler | |||
154 | offer <- peerOffer | 154 | offer <- peerOffer |
155 | if BF.null offer | 155 | if BF.null offer |
156 | then return () | 156 | then return () |
157 | else handler (Available offer) \ No newline at end of file | 157 | else handler (Available offer) |
diff --git a/src/Network/BitTorrent/Internal.hs b/src/Network/BitTorrent/Internal.hs index bf47b87b..eaeb04e8 100644 --- a/src/Network/BitTorrent/Internal.hs +++ b/src/Network/BitTorrent/Internal.hs | |||
@@ -153,14 +153,14 @@ uploadedProgress (fromIntegral -> amount) = uploaded +~ amount | |||
153 | {-# INLINE uploadedProgress #-} | 153 | {-# INLINE uploadedProgress #-} |
154 | 154 | ||
155 | -- | Used when leecher join client session. | 155 | -- | Used when leecher join client session. |
156 | enqueuedProgress :: Int -> Progress -> Progress | 156 | enqueuedProgress :: Integer -> Progress -> Progress |
157 | enqueuedProgress (fromIntegral -> amount) = left +~ amount | 157 | enqueuedProgress amount = left +~ amount |
158 | {-# INLINE enqueuedProgress #-} | 158 | {-# INLINE enqueuedProgress #-} |
159 | 159 | ||
160 | -- | Used when leecher leave client session. | 160 | -- | Used when leecher leave client session. |
161 | -- (e.g. user deletes not completed torrent) | 161 | -- (e.g. user deletes not completed torrent) |
162 | dequeuedProgress :: Int -> Progress -> Progress | 162 | dequeuedProgress :: Integer -> Progress -> Progress |
163 | dequeuedProgress (fromIntegral -> amount) = left -~ amount | 163 | dequeuedProgress amount = left -~ amount |
164 | {-# INLINE dequeuedProgress #-} | 164 | {-# INLINE dequeuedProgress #-} |
165 | 165 | ||
166 | {----------------------------------------------------------------------- | 166 | {----------------------------------------------------------------------- |
@@ -349,8 +349,10 @@ newSeeder cs t @ Torrent {..} | |||
349 | 349 | ||
350 | -- | New swarm in which the client allowed both download and upload. | 350 | -- | New swarm in which the client allowed both download and upload. |
351 | newLeecher :: ClientSession -> Torrent -> IO SwarmSession | 351 | newLeecher :: ClientSession -> Torrent -> IO SwarmSession |
352 | newLeecher cs t @ Torrent {..} | 352 | newLeecher cs t @ Torrent {..} = do |
353 | = newSwarmSession defLeacherConns (haveNone (pieceCount tInfo)) cs t | 353 | se <- newSwarmSession defLeacherConns (haveNone (pieceCount tInfo)) cs t |
354 | atomically $ modifyTVar' (currentProgress cs) (enqueuedProgress (contentLength tInfo)) | ||
355 | return se | ||
354 | 356 | ||
355 | --isLeacher :: SwarmSession -> IO Bool | 357 | --isLeacher :: SwarmSession -> IO Bool |
356 | --isLeacher = undefined | 358 | --isLeacher = undefined |