Skip to content

Commit

Permalink
Log with fatal error
Browse files Browse the repository at this point in the history
  • Loading branch information
chenBright committed Nov 28, 2023
1 parent c77d752 commit 1b636fb
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 7 deletions.
9 changes: 6 additions & 3 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 @@ -2067,9 +2068,11 @@ ssize_t Socket::DoRead(size_t size_hint) {
errno = ESSL;
} else {
// System error with corresponding errno set.
PLOG_IF(WARNING, ssl_error != SSL_ERROR_ZERO_RETURN &&
ssl_error != SSL_ERROR_SYSCALL)
<< "Fail to read from ssl_fd=" << fd();
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

0 comments on commit 1b636fb

Please sign in to comment.