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 <p.zabel@pengutronix.de>
v0.6
Philipp Zabel 2022-11-30 14:51:52 +01:00 committed by Andri Yngvason
parent bc87cbbb7d
commit afe37b983d
1 changed files with 5 additions and 1 deletions

View File

@ -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) 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); 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; self->bytes_received += rc;
return rc; return rc;
} }