From 41925d458549e5a04a148acfdbd34a39f2fedc09 Mon Sep 17 00:00:00 2001 From: Andrey Borodin Date: Mon, 24 May 2021 10:01:59 +0300 Subject: [PATCH] Fix incorrect flush_status usage in frontend code. (#328) This should prevent "unexpected error status OD_DETACH (4)" which caused abnormal server connection termination. --- sources/frontend.c | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/sources/frontend.c b/sources/frontend.c index a1b1879a..5b304cc2 100644 --- a/sources/frontend.c +++ b/sources/frontend.c @@ -944,9 +944,8 @@ static od_frontend_status_t od_frontend_remote(od_client_t *client) if (status == OD_DETACH) { /* detach on transaction pooling */ /* write any pending data to server first */ - od_frontend_status_t flush_status; - flush_status = od_relay_flush(&server->relay); - if (flush_status != OD_OK) + status = od_relay_flush(&server->relay); + if (status != OD_OK) break; od_relay_detach(&client->relay); od_relay_stop(&server->relay); @@ -954,7 +953,7 @@ static od_frontend_status_t od_frontend_remote(od_client_t *client) /* cleanup server */ rc = od_reset(server); if (rc == -1) { - flush_status = OD_ESERVER_WRITE; + status = OD_ESERVER_WRITE; break; }