Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Opt ssl read log #2451

Merged
merged 2 commits into from
Dec 3, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 7 additions & 2 deletions src/brpc/socket.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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;
}
Expand Down
5 changes: 1 addition & 4 deletions src/butil/iobuf.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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 {

Expand Down