From afe37b983db9b8fbf1189e07f756276e85a780e8 Mon Sep 17 00:00:00 2001 From: Philipp Zabel Date: Wed, 30 Nov 2022 14:51:52 +0100 Subject: [PATCH] stream: Fix remote closing TLS connection If a TLS stream is closed by the remote VNC client, stream__remote_closed must be called to signal the server. Signed-off-by: Philipp Zabel --- src/stream.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/stream.c b/src/stream.c index fa34a2d..7b54be6 100644 --- a/src/stream.c +++ b/src/stream.c @@ -354,7 +354,11 @@ static ssize_t stream__read_plain(struct stream* self, void* dst, size_t size) static ssize_t stream__read_tls(struct stream* self, void* dst, size_t size) { ssize_t rc = gnutls_record_recv(self->tls_session, dst, size); - if (rc >= 0) { + if (rc == 0) { + stream__remote_closed(self); + return rc; + } + if (rc > 0) { self->bytes_received += rc; return rc; }