From b4007330a89cefbc524b40f8049b9eaad5596f92 Mon Sep 17 00:00:00 2001 From: iefa m Date: Sun, 18 Oct 2026 22:53:42 +0530 Subject: [PATCH] client_msg_cb: stop dispatching messages once an error is pending handle_restart() returns true after scheduling an error so the error can be sent to the client, but client_msg_cb() kept handling any messages already in the read buffer. Those ran against the state left behind by the failed restart. Stop the loop once closure->error is set. relay_server_msg_cb() has the same loop and gets the same check. --- logsrvd/logsrvd.c | 4 ++++ logsrvd/logsrvd_relay.c | 4 ++++ 2 files changed, 8 insertions(+) diff --git a/logsrvd/logsrvd.c b/logsrvd/logsrvd.c index db3db786ad..663baa129b 100644 --- a/logsrvd/logsrvd.c +++ b/logsrvd/logsrvd.c @@ -1259,6 +1259,10 @@ client_msg_cb(int fd, int what, void *v) goto send_error; } buf->off += msg_len; + + /* Don't process any more messages once an error is pending. */ + if (closure->error) + break; } if (buf->len != buf->off) { memmove(buf->data, buf->data + buf->off, buf->len - buf->off); diff --git a/logsrvd/logsrvd_relay.c b/logsrvd/logsrvd_relay.c index 79fa11e2f0..f2555873e3 100644 --- a/logsrvd/logsrvd_relay.c +++ b/logsrvd/logsrvd_relay.c @@ -920,6 +920,10 @@ relay_server_msg_cb(int fd, int what, void *v) if (!handle_server_message(buf->data + buf->off, msg_len, closure)) goto send_error; buf->off += msg_len; + + /* Don't process any more messages once an error is pending. */ + if (closure->error) + break; } if (buf->len != buf->off) { memmove(buf->data, buf->data + buf->off, buf->len - buf->off);