diff options
Diffstat (limited to 'src/Network/BitTorrent/Internal.lhs')
-rw-r--r-- | src/Network/BitTorrent/Internal.lhs | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/src/Network/BitTorrent/Internal.lhs b/src/Network/BitTorrent/Internal.lhs index 7edcc977..5f6ad458 100644 --- a/src/Network/BitTorrent/Internal.lhs +++ b/src/Network/BitTorrent/Internal.lhs | |||
@@ -56,9 +56,8 @@ | |||
56 | > , newSeeder | 56 | > , newSeeder |
57 | > , getClientBitfield | 57 | > , getClientBitfield |
58 | > | 58 | > |
59 | > , enterSwarm | ||
60 | > , leaveSwarm | ||
61 | > , waitVacancy | 59 | > , waitVacancy |
60 | > , forkThrottle | ||
62 | > | 61 | > |
63 | > , pieceLength | 62 | > , pieceLength |
64 | > | 63 | > |
@@ -616,6 +615,13 @@ Peer sessions throttling | |||
616 | > bracket (enterSwarm se) (const (leaveSwarm se)) | 615 | > bracket (enterSwarm se) (const (leaveSwarm se)) |
617 | > . const | 616 | > . const |
618 | 617 | ||
618 | > forkThrottle :: SwarmSession -> IO () -> IO ThreadId | ||
619 | > forkThrottle se action = do | ||
620 | > enterSwarm se | ||
621 | > (forkIO $ do | ||
622 | > action `finally` leaveSwarm se) | ||
623 | > `onException` leaveSwarm se | ||
624 | |||
619 | Peer sessions | 625 | Peer sessions |
620 | ------------------------------------------------------------------------ | 626 | ------------------------------------------------------------------------ |
621 | 627 | ||