From 9c763af25e7b5456593b3b2d48b2a76005534175 Mon Sep 17 00:00:00 2001 From: Kevin Chou Date: Thu, 5 Feb 2026 15:20:10 +0800 Subject: [PATCH] handle the error case that ssl_error is SSL_ERROR_SYSCALL and errno is zero --- src/brpc/socket.cpp | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/src/brpc/socket.cpp b/src/brpc/socket.cpp index 9c1acfea..b2573b94 100644 --- a/src/brpc/socket.cpp +++ b/src/brpc/socket.cpp @@ -2310,6 +2310,10 @@ ssize_t Socket::DoWrite(WriteRequest* req) { } else { // System error with corresponding errno set PLOG(WARNING) << "Fail to write into ssl_fd=" << fd(); + if (ssl_error == SSL_ERROR_SYSCALL && errno == 0) { + // Connection is reset by remote. + errno = ECONNRESET; + } } break; } @@ -2465,6 +2469,10 @@ ssize_t Socket::DoRead(size_t size_hint) { } else { // System error with corresponding errno set PLOG(WARNING) << "Fail to read from ssl_fd=" << fd(); + if (ssl_error == SSL_ERROR_SYSCALL && errno == 0) { + // Connection is reset by remote. + errno = ECONNRESET; + } } break; }