Simplify check introduced in commit '6c9e4c05'

- Removed redundant part of check.
- Updated comment, elaborating on 'POLLHUP' omission in the check.
pull/4321/head
Javier Jaramago Fernández 3 years ago
parent 6aaf9c81cc
commit bb2b429bca

@ -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();
}

Loading…
Cancel
Save