Felix-Gong commented on code in PR #3316:
URL: https://github.com/apache/brpc/pull/3316#discussion_r3328169041
##########
src/brpc/socket.cpp:
##########
@@ -2133,11 +2133,19 @@ ssize_t Socket::DoRead(size_t size_hint) {
default: {
const unsigned long e = ERR_get_error();
if (nr == 0) {
- // Socket EOF or SSL session EOF
+ if (ssl_error != SSL_ERROR_ZERO_RETURN) {
+ // Unexpected EOF without proper SSL shutdown (close_notify)
+ LOG(WARNING) << "Fail to read from ssl_fd=" << fd()
+ << ": unexpected ssl_error=" << ssl_error;
+ errno = ESSL;
+ return -1;
+ }
+ // Clean SSL shutdown (close_notify received)
} else if (e != 0) {
LOG(WARNING) << "Fail to read from ssl_fd=" << fd()
<< ": " << SSLError(e);
errno = ESSL;
+ return -1;
Review Comment:
You're right. No changes are needed for this branch — the real fix is only
in the if (nr == 0) branch where the original code fell through and returned 0
without distinguishing unexpected SSL EOF from a clean shutdown. I'll revert
this change.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]