From 8d3139ccce6dc289c21c459b1626b236b8a8d1fb Mon Sep 17 00:00:00 2001 From: "carpentry-heartbeat[bot]" Date: Fri, 19 Jun 2026 22:41:43 +0200 Subject: [PATCH] capture SSL error on send/send-bytes write failure --- src/tls_stream.h | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/src/tls_stream.h b/src/tls_stream.h index 501209f..ee3f314 100644 --- a/src/tls_stream.h +++ b/src/tls_stream.h @@ -176,7 +176,10 @@ int TlsStream_send_(TlsStream *s, String *msg) { size_t sent = 0; while (sent < len) { int n = SSL_write(s->ssl, *msg + sent, carp_tls_write_chunk(len - sent)); - if (n <= 0) return -1; + if (n <= 0) { + carp_tls_capture_ssl_error(SSL_get_error(s->ssl, n)); + return -1; + } sent += n; } return sent > (size_t)INT_MAX ? INT_MAX : (int)sent; @@ -188,7 +191,10 @@ int TlsStream_send_MINUS_bytes_(TlsStream *s, Array *data) { while (sent < len) { int n = SSL_write(s->ssl, (char *)data->data + sent, carp_tls_write_chunk(len - sent)); - if (n <= 0) return -1; + if (n <= 0) { + carp_tls_capture_ssl_error(SSL_get_error(s->ssl, n)); + return -1; + } sent += n; } return sent > (size_t)INT_MAX ? INT_MAX : (int)sent;