Yepp, the 2nd check was double + re-aranged the log messages that before
[hub.git] / application / hub / classes / helper / connection / ipv4 / class_BaseIpV4ConnectionHelper.php
index f1dfa8305cac5a90949a5e56e31f7ab40afe46aa..895acb9ac9037bf6840ae002a5224f1565d5e203 100644 (file)
@@ -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 {