summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorSam T <pxqr.sta@gmail.com>2013-08-16 17:34:45 +0400
committerSam T <pxqr.sta@gmail.com>2013-08-16 17:34:45 +0400
commitec3d89b295a004e992dec3ba03a7efe9a1b62fe2 (patch)
treea0549e77726370a950f0078f3830d09081efdbde /src
parent93c37407f9f30c92f2aa3cfd8f0001c78a8ab476 (diff)
~ Make enterSwarm exception safe.
Diffstat (limited to 'src')
-rw-r--r--src/Network/BitTorrent/Sessions.hs3
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
297enterSwarm :: SwarmSession -> IO () 297enterSwarm :: SwarmSession -> IO ()
298enterSwarm SwarmSession {..} = do 298enterSwarm 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
302leaveSwarm :: SwarmSession -> IO () 303leaveSwarm :: SwarmSession -> IO ()
303leaveSwarm SwarmSession {..} = mask_ $ do 304leaveSwarm SwarmSession {..} = mask_ $ do