Make server process killable

35163c3c18
introduced a new use of `mask` which makes the server process uninterruptible
while waiting for a new incoming request.  This change fixes that by
surrounding the logic that waits for a new request with `unmask`.  This
new `unmask` should still respect the finalization guarantees of the
surrounding masked code.
This commit is contained in:
Gabriel Gonzalez 2020-05-27 16:45:37 -07:00
parent 595cb6a3bf
commit d4a80a9a4e

View file

@ -48,7 +48,7 @@ withServerCallAsync :: Server
-> (ServerCall -> IO ()) -> (ServerCall -> IO ())
-> IO () -> IO ()
withServerCallAsync s f = mask $ \unmask -> withServerCallAsync s f = mask $ \unmask ->
serverCreateCall s >>= \case unmask (serverCreateCall s) >>= \case
Left e -> do grpcDebug $ "withServerCallAsync: call error: " ++ show e Left e -> do grpcDebug $ "withServerCallAsync: call error: " ++ show e
return () return ()
Right c -> do wasForkSuccess <- forkServer s handler Right c -> do wasForkSuccess <- forkServer s handler