summaryrefslogtreecommitdiff
path: root/src/Network/BitTorrent/Internal.hs
diff options
context:
space:
mode:
Diffstat (limited to 'src/Network/BitTorrent/Internal.hs')
-rw-r--r--src/Network/BitTorrent/Internal.hs14
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.
156enqueuedProgress :: Int -> Progress -> Progress 156enqueuedProgress :: Integer -> Progress -> Progress
157enqueuedProgress (fromIntegral -> amount) = left +~ amount 157enqueuedProgress 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)
162dequeuedProgress :: Int -> Progress -> Progress 162dequeuedProgress :: Integer -> Progress -> Progress
163dequeuedProgress (fromIntegral -> amount) = left -~ amount 163dequeuedProgress 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.
351newLeecher :: ClientSession -> Torrent -> IO SwarmSession 351newLeecher :: ClientSession -> Torrent -> IO SwarmSession
352newLeecher cs t @ Torrent {..} 352newLeecher 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