From bb2b429bca1e3ff9a7ce332d2312c4722452a0a2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Javier=20Jaramago=20Fern=C3=A1ndez?= Date: Tue, 15 Aug 2023 12:07:02 +0200 Subject: [PATCH] Simplify check introduced in commit '6c9e4c05' - Removed redundant part of check. - Updated comment, elaborating on 'POLLHUP' omission in the check. --- lib/mysql_data_stream.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/lib/mysql_data_stream.cpp b/lib/mysql_data_stream.cpp index 8b5155607..5eea659e2 100644 --- a/lib/mysql_data_stream.cpp +++ b/lib/mysql_data_stream.cpp @@ -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(); }