From 19189c78dc13c68910abf1f5ec84c1154bd593fb Mon Sep 17 00:00:00 2001 From: Arie Peterson <arie@greenhost.nl> Date: Wed, 12 Jul 2017 10:48:33 +0200 Subject: [PATCH] Give request handlers more time on reboot Sleep for a bit after we received a signal to stop cryptops-api. This gives the request handler that asked to stop the server more time to send its response to the client, fixing a race condition. --- src/cryptops-api.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/cryptops-api.c b/src/cryptops-api.c index c066ad0..6b1e6d2 100644 --- a/src/cryptops-api.c +++ b/src/cryptops-api.c @@ -101,6 +101,10 @@ int main(int argc, char ** argv) y_log_message(Y_LOG_LEVEL_DEBUG, "Error starting framework"); } y_log_message(Y_LOG_LEVEL_DEBUG, "End framework"); + + // Give request handlers that have called for the stop a chance to + // send their response to the client. + sleep(1); y_close_logs(); -- GitLab