From 79d24ae0ca91ad0b38f0953547b74915940b4ace Mon Sep 17 00:00:00 2001 From: Andri Yngvason Date: Tue, 11 Apr 2023 20:33:13 +0000 Subject: [PATCH] stream-gnutls: Handle EAGAIN correctly --- src/stream-gnutls.c | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/src/stream-gnutls.c b/src/stream-gnutls.c index bb66163..ad1bc9c 100644 --- a/src/stream-gnutls.c +++ b/src/stream-gnutls.c @@ -76,10 +76,13 @@ static int stream_gnutls__flush(struct stream* self) self->tls_session, req->payload->payload, req->payload->size); if (rc < 0) { - gnutls_record_discard_queued(self->tls_session); - if (gnutls_error_is_fatal(rc)) + if (gnutls_error_is_fatal(rc)) { stream_close(self); - return -1; + return -1; + } + + stream__poll_rw(self); + return 0; } self->bytes_sent += rc;