Skip to content

Commit

Permalink
Simplify check introduced in commit '6c9e4c05'
Browse files Browse the repository at this point in the history
- Removed redundant part of check.
- Updated comment, elaborating on 'POLLHUP' omission in the check.
  • Loading branch information
JavierJF committed Aug 15, 2023
1 parent 6aaf9c8 commit bb2b429
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions lib/mysql_data_stream.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -667,10 +667,10 @@ int MySQL_Data_Stream::read_from_net() {
proxy_debug(PROXY_DEBUG_NET, 5, "Session=%p, Datastream=%p -- SSL_get_error() is SSL_ERROR_SYSCALL, errno: %d\n", sess, this, errno);
} else {
if (r==0) { // we couldn't read any data
if ((revents & POLLIN) || ((revents & POLLIN) && (revents & POLLHUP))) {
if (revents & POLLIN) {
// If revents is holding either POLLIN, or POLLIN and POLLHUP, but 'recv()' returns 0,
// reading no data, the socket has been already closed by the peer. Second part of the
// check is obviously redundant, but is left for clarity on the cases being covered.
// reading no data, the socket has been already closed by the peer. Due to this we can
// ignore POLLHUP in this check, since we should reach here ONLY if POLLIN was set.
proxy_debug(PROXY_DEBUG_NET, 5, "Session=%p, Datastream=%p -- shutdown soft\n", sess, this);
shut_soft();
}
Expand Down

0 comments on commit bb2b429

Please sign in to comment.