diff options
Diffstat (limited to 'src/Network/BitTorrent')
-rw-r--r-- | src/Network/BitTorrent/Internal.hs | 14 |
1 files changed, 8 insertions, 6 deletions
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 |