Make server process killable (#105)

35163c3 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-28 10:56:03 -07:00 committed by GitHub
parent 595cb6a3bf
commit d532cec4d1
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

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