This is an automated email from the ASF dual-hosted git repository.
jiashunzhu pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/brpc.git
The following commit(s) were added to refs/heads/master by this push:
new e6e5516e Opt ssl read log (#2451)
e6e5516e is described below
commit e6e5516e32853038b060cc7e0d005bb375bd5b85
Author: Bright Chen <[email protected]>
AuthorDate: Mon Dec 4 00:23:20 2023 +0800
Opt ssl read log (#2451)
* Opt ssl read log
* Log with fatal error
---
src/brpc/socket.cpp | 9 +++++++--
src/butil/iobuf.cpp | 5 +----
2 files changed, 8 insertions(+), 6 deletions(-)
diff --git a/src/brpc/socket.cpp b/src/brpc/socket.cpp
index 3cef97df..6b7eadf3 100644
--- a/src/brpc/socket.cpp
+++ b/src/brpc/socket.cpp
@@ -17,6 +17,7 @@
#include "butil/compat.h" // OS_MACOSX
+#include "butil/ssl_compat.h" // BIO_fd_non_fatal_error
#include <openssl/ssl.h>
#include <openssl/err.h>
#ifdef USE_MESALINK
@@ -2066,8 +2067,12 @@ ssize_t Socket::DoRead(size_t size_hint) {
<< ": " << SSLError(e);
errno = ESSL;
} else {
- // System error with corresponding errno set
- PLOG(WARNING) << "Fail to read from ssl_fd=" << fd();
+ // System error with corresponding errno set.
+ bool is_fatal_error = (ssl_error != SSL_ERROR_ZERO_RETURN &&
+ ssl_error != SSL_ERROR_SYSCALL) ||
+ BIO_fd_non_fatal_error(errno) != 0 ||
+ nr < 0;
+ PLOG_IF(WARNING, is_fatal_error) << "Fail to read from ssl_fd=" <<
fd();
}
break;
}
diff --git a/src/butil/iobuf.cpp b/src/butil/iobuf.cpp
index e4395266..169e76ce 100644
--- a/src/butil/iobuf.cpp
+++ b/src/butil/iobuf.cpp
@@ -19,6 +19,7 @@
// Date: Thu Nov 22 13:57:56 CST 2012
+#include "butil/ssl_compat.h" // BIO_fd_non_fatal_error
#include <openssl/err.h>
#include <openssl/ssl.h> // SSL_*
#ifdef USE_MESALINK
@@ -38,10 +39,6 @@
#include "butil/fd_guard.h" // butil::fd_guard
#include "butil/iobuf.h"
-#if defined (OPENSSL_IS_BORINGSSL)
-#include "butil/ssl_compat.h" // BIO_fd_non_fatal_error
-#endif
-
namespace butil {
namespace iobuf {
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]