From d532cec4d1304f307eea618c3bdcef80dd46bf2a Mon Sep 17 00:00:00 2001 From: Gabriel Gonzalez Date: Thu, 28 May 2020 10:56:03 -0700 Subject: [PATCH] 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. --- core/src/Network/GRPC/LowLevel/Server/Unregistered.hs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/core/src/Network/GRPC/LowLevel/Server/Unregistered.hs b/core/src/Network/GRPC/LowLevel/Server/Unregistered.hs index 6f7309c..ae06f1e 100644 --- a/core/src/Network/GRPC/LowLevel/Server/Unregistered.hs +++ b/core/src/Network/GRPC/LowLevel/Server/Unregistered.hs @@ -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