File tree 1 file changed +11
-3
lines changed
1 file changed +11
-3
lines changed Original file line number Diff line number Diff line change @@ -98,7 +98,7 @@ getRTT ctx = do
98
98
--
99
99
-- this doesn't actually close the handle
100
100
bye :: MonadIO m => Context -> m ()
101
- bye ctx = liftIO $ do
101
+ bye ctx = liftIO $ E. handle swallowSync $ do
102
102
eof <- ctxEOF ctx
103
103
tls13 <- tls13orLater ctx
104
104
when (tls13 && not eof) $ do
@@ -112,7 +112,7 @@ bye ctx = liftIO $ do
112
112
unless recvNST $ do
113
113
rtt <- getRTT ctx
114
114
var <- newEmptyMVar
115
- _ <- forkIOWithUnmask $ \ umask ->
115
+ _ <- forkIOWithUnmask $ \ umask -> E. handle swallowSync $
116
116
umask (void $ timeout rtt $ recvHS13 ctx chk) `E.finally` putMVar var ()
117
117
takeMVar var
118
118
else do
@@ -124,10 +124,18 @@ bye ctx = liftIO $ do
124
124
-- fixme: 1sec is good enough?
125
125
let rtt = 1000000
126
126
var <- newEmptyMVar
127
- _ <- forkIOWithUnmask $ \ umask ->
127
+ _ <- forkIOWithUnmask $ \ umask -> E. handle swallowSync $
128
128
umask (void $ timeout rtt $ recvHS13 ctx chk) `E.finally` putMVar var ()
129
129
takeMVar var
130
130
bye_ ctx
131
+ where
132
+ -- Swallow synchronous exceptions, rethrow asynchronous exceptions
133
+ swallowSync :: E. SomeException -> IO ()
134
+ swallowSync e
135
+ | Just (E. SomeAsyncException ae) <- E. fromException e
136
+ = E. throwIO ae
137
+ | otherwise
138
+ = return ()
131
139
132
140
bye_ :: MonadIO m => Context -> m ()
133
141
bye_ ctx = liftIO $ do
You can’t perform that action at this time.
0 commit comments