From cde18272ceda8e6acacbb49935698a3b0b5ccd44 Mon Sep 17 00:00:00 2001 From: Andri Yngvason Date: Wed, 29 Jun 2022 11:49:44 +0000 Subject: [PATCH] Handle all buffered messages in the socket handler Otherwise, some buffered messages will be left over --- src/vnc.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/src/vnc.c b/src/vnc.c index a2ba7c6..b4f9b29 100644 --- a/src/vnc.c +++ b/src/vnc.c @@ -368,7 +368,13 @@ int vnc_client_process(struct vnc_client* self) if (!vnc_client_lock_handler(self)) return 0; - int rc = HandleRFBServerMessage(self->client) ? 0 : -1; + int rc; + while (self->client->buffered > 0) { + rc = HandleRFBServerMessage(self->client) ? 0 : -1; + if (rc < 0) + break; + } + vnc_client_unlock_handler(self); return rc; }