diff options
author | Sam T <pxqr.sta@gmail.com> | 2013-08-16 17:34:45 +0400 |
---|---|---|
committer | Sam T <pxqr.sta@gmail.com> | 2013-08-16 17:34:45 +0400 |
commit | ec3d89b295a004e992dec3ba03a7efe9a1b62fe2 (patch) | |
tree | a0549e77726370a950f0078f3830d09081efdbde /src | |
parent | 93c37407f9f30c92f2aa3cfd8f0001c78a8ab476 (diff) |
~ Make enterSwarm exception safe.
Diffstat (limited to 'src')
-rw-r--r-- | src/Network/BitTorrent/Sessions.hs | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/src/Network/BitTorrent/Sessions.hs b/src/Network/BitTorrent/Sessions.hs index f2035066..9713f438 100644 --- a/src/Network/BitTorrent/Sessions.hs +++ b/src/Network/BitTorrent/Sessions.hs | |||
@@ -297,7 +297,8 @@ defaultThreadCount = 1000 | |||
297 | enterSwarm :: SwarmSession -> IO () | 297 | enterSwarm :: SwarmSession -> IO () |
298 | enterSwarm SwarmSession {..} = do | 298 | enterSwarm SwarmSession {..} = do |
299 | MSem.wait (activeThreads clientSession) | 299 | MSem.wait (activeThreads clientSession) |
300 | MSem.wait vacantPeers | 300 | MSem.wait vacantPeers `onException` |
301 | MSem.signal (activeThreads clientSession) | ||
301 | 302 | ||
302 | leaveSwarm :: SwarmSession -> IO () | 303 | leaveSwarm :: SwarmSession -> IO () |
303 | leaveSwarm SwarmSession {..} = mask_ $ do | 304 | leaveSwarm SwarmSession {..} = mask_ $ do |