Skip to content

Commit

Permalink
connect & accept: change the scope of masked exceptions
Browse files Browse the repository at this point in the history
Limit the scope of masked exceptions only to the
'Network.Socket.connect' / 'Network.Socket.accept' call.
  • Loading branch information
coot committed Feb 14, 2020
1 parent 880e629 commit 3806a47
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions Win32-network/src/System/Win32/Async/Socket.hs
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ connect :: Socket -> SockAddr -> IO ()
connect sock addr = do
v <- newEmptyMVar
_ <- mask_ $ forkIOWithUnmask $ \unmask ->
unmask (Socket.connect sock addr >> putMVar v Nothing)
(unmask (Socket.connect sock addr) >> putMVar v Nothing)
`catch` (\(e :: IOException) -> putMVar v (Just e))
r <- takeMVar v
case r of
Expand All @@ -76,7 +76,7 @@ accept :: Socket -> IO (Socket, SockAddr)
accept sock = do
v <- newEmptyMVar
_ <- mask_ $ forkIOWithUnmask $ \unmask ->
unmask (Socket.accept sock >>= putMVar v . Right)
(unmask (Socket.accept sock) >>= putMVar v . Right)
`catch` (\(e :: IOException) -> putMVar v (Left e))
r <- takeMVar v
case r of
Expand Down

0 comments on commit 3806a47

Please sign in to comment.