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 27, 2023
1 parent c77d752 commit 5cf6c84
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions src/brpc/socket.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
#include "butil/compat.h" // OS_MACOSX
#include <openssl/ssl.h>
#include <openssl/err.h>
#include <openssl/bio.h>
#ifdef USE_MESALINK
#include <mesalink/openssl/ssl.h>
#include <mesalink/openssl/err.h>
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

0 comments on commit 5cf6c84

Please sign in to comment.