LibTLS: Retry sending in TLSv12::flush() on EAGAIN or EINTR

Crashing here is not very helpful.
This commit is contained in:
Andrew Kaster 2023-10-30 12:22:38 -06:00 committed by Ali Mohammad Pur
parent c93d367d95
commit baa26d10a8
Notes: sideshowbarker 2024-07-17 18:46:57 +09:00

View file

@ -271,11 +271,14 @@ ErrorOr<bool> TLSv12::flush()
size_t written;
do {
auto result = stream.write_some(out_bytes);
if (result.is_error() && result.error().code() != EINTR && result.error().code() != EAGAIN) {
if (result.is_error()) {
if (result.error().code() != EINTR && result.error().code() != EAGAIN) {
error = result.release_error();
dbgln("TLS Socket write error: {}", *error);
break;
}
continue;
}
written = result.value();
out_bytes = out_bytes.slice(written);
} while (!out_bytes.is_empty());