From 4140ec0c3d51dfab2dff95fb8b5895821b90238d Mon Sep 17 00:00:00 2001 From: Roland Haeder Date: Tue, 22 Dec 2015 21:53:53 +0100 Subject: [PATCH] Yepp, the 2nd check was double + re-aranged the log messages that before clearing "operation in progress" all original data is logged. Signed-off-by: Roland Haeder --- .../ipv4/class_BaseIpV4ConnectionHelper.php | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/application/hub/classes/helper/connection/ipv4/class_BaseIpV4ConnectionHelper.php b/application/hub/classes/helper/connection/ipv4/class_BaseIpV4ConnectionHelper.php index f1dfa8305..895acb9ac 100644 --- a/application/hub/classes/helper/connection/ipv4/class_BaseIpV4ConnectionHelper.php +++ b/application/hub/classes/helper/connection/ipv4/class_BaseIpV4ConnectionHelper.php @@ -157,6 +157,9 @@ class BaseIpV4ConnectionHelper extends BaseConnectionHelper { } } // END - while + // Log error code + /* DEBUG: */ self::createDebugInstance(__CLASS__)->debugOutput('CONNECTION-HELPER[' . __METHOD__ . ':' . __LINE__ . ']: socketError=' . $socketError . ',isConnected=' . intval($isConnected) . ',hasTimedOut=' . intval($hasTimedOut) . ' after while() loop.'); + /* * All IPv4-based connections are non-blocking used by this program or * else the PHP process will "hang" until a peer connects which is not @@ -164,6 +167,9 @@ class BaseIpV4ConnectionHelper extends BaseConnectionHelper { * isConnected=FALSE here. */ if (($hasTimedOut === FALSE) && ($socketError == SOCKET_EINPROGRESS)) { + // Debug message + /* DEBUG: */ self::createDebugInstance(__CLASS__)->debugOutput('CONNECTION-HELPER[' . __METHOD__ . ':' . __LINE__ . ']: Clearing "operation in progress" as this is for 99.999% chance a non-blocking I/O operation.'); + // A "connection in progress" has not timed out. All fine. $isConnected = TRUE; @@ -171,11 +177,8 @@ class BaseIpV4ConnectionHelper extends BaseConnectionHelper { socket_clear_error($socketResource); } // END - if - // Log error code - /* DEBUG: */ self::createDebugInstance(__CLASS__)->debugOutput('CONNECTION-HELPER[' . __METHOD__ . ':' . __LINE__ . ']: socketError=' . $socketError . ',isConnected=' . intval($isConnected) . ',hasTimedOut=' . intval($hasTimedOut) . ' after while() loop.'); - // Is the peer connected? - if (($isConnected === TRUE) || (($socketError == SOCKET_EINPROGRESS) && ($hasTimedOut === FALSE))) { + if ($isConnected === TRUE) { // Connection is fully established here, so change the state. PeerStateFactory::createPeerStateInstanceByName('connected', $this); } else { -- 2.30.2