stream-gnutls: Handle EAGAIN correctly

websockets
Andri Yngvason 2023-04-11 20:33:13 +00:00
parent 4b5e4d628d
commit 79d24ae0ca
1 changed files with 6 additions and 3 deletions

View File

@ -76,12 +76,15 @@ static int stream_gnutls__flush(struct stream* self)
self->tls_session, req->payload->payload, self->tls_session, req->payload->payload,
req->payload->size); req->payload->size);
if (rc < 0) { 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); stream_close(self);
return -1; return -1;
} }
stream__poll_rw(self);
return 0;
}
self->bytes_sent += rc; self->bytes_sent += rc;
ssize_t remaining = req->payload->size - rc; ssize_t remaining = req->payload->size - rc;