}
} // 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
* 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;
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 {