]> git.mxchange.org Git - hub.git/blobdiff - application/hub/main/helper/connection/class_BaseConnectionHelper.php
Continued:
[hub.git] / application / hub / main / helper / connection / class_BaseConnectionHelper.php
index c854646427cb9d6068499d698051c3f94142f610..eede0f8f3a9800eb0104794bd47849be2254d15c 100644 (file)
@@ -2,11 +2,11 @@
 /**
  * A general ConnectionHelper class
  *
- * @author             Roland Haeder <webmaster@ship-simu.org>
+ * @author             Roland Haeder <webmaster@shipsimu.org>
  * @version            0.0.0
- * @copyright  Copyright (c) 2007, 2008 Roland Haeder, 2009 - 2011 Hub Developer Team
+ * @copyright  Copyright (c) 2007, 2008 Roland Haeder, 2009 - 2012 Hub Developer Team
  * @license            GNU GPL 3.0 or any newer version
- * @link               http://www.ship-simu.org
+ * @link               http://www.shipsimu.org
  *
  * This program is free software: you can redistribute it and/or modify
  * it under the terms of the GNU General Public License as published by
  * You should have received a copy of the GNU General Public License
  * along with this program.  If not, see <http://www.gnu.org/licenses/>.
  */
-class BaseConnectionHelper extends BaseHubHelper implements Registerable, ProtocolHandler {
+class BaseConnectionHelper extends BaseHubSystemHelper implements Registerable, ProtocolHandler {
        // Exception codes
-       const EXCEPTION_UNSUPPORTED_ERROR_HANDLER = 0x900;
+       const EXCEPTION_UNSUPPORTED_ERROR_HANDLER = 0x9100;
+
+       /**
+        * Connection type 'incoming'
+        */
+       const CONNECTION_TYPE_INCOMING = 'incoming';
+
+       /**
+        * Connection type 'outgoing'
+        */
+       const CONNECTION_TYPE_OUTGOING = 'outgoing';
+
+       /**
+        * Connection type 'server'
+        */
+       const CONNECTION_TYPE_SERVER   = 'server';
 
        /**
         * Protocol used
@@ -45,20 +60,15 @@ class BaseConnectionHelper extends BaseHubHelper implements Registerable, Protoc
         */
        private $sentData = 0;
 
-       /**
-        * Difference
-        */
-       private $diff = 0;
-
        /**
         * Whether this connection is initialized
         */
-       private $isInitialized = false;
+       private $isInitialized = FALSE;
 
        /**
         * Whether this connection is shutted down
         */
-       private $shuttedDown = false;
+       private $shuttedDown = FALSE;
 
        /**
         * Currently queued chunks
@@ -80,14 +90,20 @@ class BaseConnectionHelper extends BaseHubHelper implements Registerable, Protoc
                // Call parent constructor
                parent::__construct($className);
 
+               // Init state which sets the state to 'init'
+               $this->initState();
+
                // Initialize output stream
                $streamInstance = ObjectFactory::createObjectByConfiguredName('node_raw_data_output_stream_class');
 
                // And add it to this connection helper
                $this->setOutputStreamInstance($streamInstance);
 
-               // Init state which sets the state to 'init'
-               $this->initState();
+               // Get package instance from factory
+               $packageInstance = NetworkPackageFactory::createNetworkPackageInstance();
+
+               // ... and set it here
+               $this->setPackageInstance($packageInstance);
 
                // Register this connection helper
                Registry::getRegistry()->addInstance('connection', $this);
@@ -182,7 +198,7 @@ class BaseConnectionHelper extends BaseHubHelper implements Registerable, Protoc
                // Set the option to reuse the port
                if (!socket_set_option($socketResource, SOL_SOCKET, SO_REUSEADDR, 1)) {
                        // Handle this socket error with a faked recipientData array
-                       $this->handleSocketError($socketResource, array('0.0.0.0', '0'));
+                       $this->handleSocketError(__METHOD__, __LINE__, $socketResource, array('0.0.0.0', '0'));
 
                        // And throw again
                        // @TODO Move this to the socket error handler
@@ -196,14 +212,14 @@ class BaseConnectionHelper extends BaseHubHelper implements Registerable, Protoc
                 */
                if (!socket_set_nonblock($socketResource)) {
                        // Handle this socket error with a faked recipientData array
-                       $helperInstance->handleSocketError($socketResource, array('0.0.0.0', '0'));
+                       $helperInstance->handleSocketError(__METHOD__, __LINE__, $socketResource, array('0.0.0.0', '0'));
 
                        // And throw again
                        throw new SocketOptionException(array($helperInstance, $socketResource, $socketError, $errorMessage), BaseListener::EXCEPTION_INVALID_SOCKET);
                } // END - if
 
                // Last step: mark connection as initialized
-               $this->isInitialized = true;
+               $this->isInitialized = TRUE;
        }
 
        /**
@@ -215,9 +231,9 @@ class BaseConnectionHelper extends BaseHubHelper implements Registerable, Protoc
         * @see         Please see http://de.php.net/manual/en/function.socket-connect.php#84465 for original code
         * @todo        Rewrite the while() loop to a iterator to not let the software stay very long here
         */
-       protected function connectToPeerByRecipientDataArray (array $recipientData) {
+       protected function connectToPeerByRecipientData (array $recipientData) {
                // Only call this if the connection is initialized by initConnection()
-               assert($this->isInitialized === true);
+               assert($this->isInitialized === TRUE);
 
                // Get current time
                $time = time();
@@ -227,7 +243,7 @@ class BaseConnectionHelper extends BaseHubHelper implements Registerable, Protoc
                $timeout = $this->getConfigInstance()->getConfigEntry('socket_timeout_seconds');
 
                // Debug output
-               $this->debugOutput('CONNECTION-HELPER: Trying to connect to ' . $recipientData[0] . ':' . $recipientData[1] . ' with socketResource[' . gettype($socketResource) . ']=' . $socketResource . ' ...');
+               self::createDebugInstance(__CLASS__)->debugOutput('CONNECTION-HELPER[' . __METHOD__ . ':' . __LINE__ . ']: Trying to connect to ' . $recipientData[0] . ':' . $recipientData[1] . ' with socketResource[' . gettype($socketResource) . ']=' . $socketResource . ' ...');
 
                // Try to connect until it is connected
                while ($isConnected = !@socket_connect($socketResource, $recipientData[0], $recipientData[1])) {
@@ -239,7 +255,7 @@ class BaseConnectionHelper extends BaseHubHelper implements Registerable, Protoc
                                // Now, is that attempt within parameters?
                                if ((time() - $time) >= $timeout) {
                                        // Didn't work within timeout
-                                       $isConnected = false;
+                                       $isConnected = FALSE;
                                        break;
                                } // END - if
 
@@ -247,11 +263,23 @@ class BaseConnectionHelper extends BaseHubHelper implements Registerable, Protoc
                                $this->idle(1000);
                        } elseif ($socketError != 0) {
                                // Stop on everything else pronto
-                               $isConnected = false;
+                               $isConnected = FALSE;
                                break;
                        }
                } // END - while
 
+               // Is the peer connected?
+               if ($isConnected === TRUE) {
+                       // Connection is fully established here, so change the state.
+                       PeerStateFactory::createPeerStateInstanceByName('connected', $this);
+               } else {
+                       /*
+                        * There was a problem connecting to the peer (this state is a meta
+                        * state until the error handler has found the real cause).
+                        */
+                       PeerStateFactory::createPeerStateInstanceByName('problem', $this);
+               }
+
                // Return status
                return $isConnected;
        }
@@ -278,10 +306,7 @@ class BaseConnectionHelper extends BaseHubHelper implements Registerable, Protoc
         * @return      void
         */
        private function initState() {
-               /*
-                * Get the state factory and create the initial state, we don't need
-                * the state instance here
-                */
+               // Get the state factory and create the initial state.
                PeerStateFactory::createPeerStateInstanceByName('init', $this);
        }
 
@@ -291,45 +316,43 @@ class BaseConnectionHelper extends BaseHubHelper implements Registerable, Protoc
         * The rest is being held in a back-buffer and waits there for the next
         * cycle and while be then sent.
         *
-        * This method does 4 simple steps:
-        * 1) Aquire fragmenter object instance from the factory
-        * 2) Handle over the package data array to the fragmenter
-        * 3) Request a chunk
-        * 4) Finally return the chunk (array) to the caller
+        * This method does 2 simple steps:
+        * 1) Request a chunk from set fragmenter instance
+        * 2) Finally return the chunk (array) to the caller
         *
         * @param       $packageData    Raw package data array
         * @return      $chunkData              Raw data chunk
         */
        private function getRawDataFromPackageArray (array $packageData) {
-               // Implode the package data array and fragement the resulting string, returns the final hash
-               $finalHash = $this->getFragmenterInstance()->fragmentPackageArray($packageData, $this);
-               if ($finalHash !== true) {
-                       $this->currentFinalHash = $finalHash;
-               } // END - if
-
                // Debug message
-               //* NOISY-DEBUG: */ $this->debugOutput('CONNECTION: currentFinalHash=' . $this->currentFinalHash);
+               //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__)->debugOutput('CONNECTION-HELPER[' . __METHOD__ . ':' . __LINE__ . ']: currentFinalHash=' . $this->currentFinalHash);
+
+               // Make sure the final hash is set
+               assert((is_string($this->currentFinalHash)) && (!empty($this->currentFinalHash)));
 
                // Get the next raw data chunk from the fragmenter
                $rawDataChunk = $this->getFragmenterInstance()->getNextRawDataChunk($this->currentFinalHash);
 
+               // Debug message
+               //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__)->debugOutput('CONNECTION-HELPER[' . __METHOD__ . ':' . __LINE__ . ']: rawDataChunk=' . print_r($rawDataChunk, TRUE));
+
                // Get chunk hashes and chunk data
                $chunkHashes = array_keys($rawDataChunk);
                $chunkData   = array_values($rawDataChunk);
 
                // Is the required data there?
-               //* NOISY-DEBUG: */ $this->debugOutput('CONNECTION: chunkHashes[]=' . count($chunkHashes) . ',chunkData[]=' . count($chunkData));
-               //* NOISY-DEBUG: */ $this->debugOutput('chunkData='.print_r($chunkData,true));
+               //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__)->debugOutput('CONNECTION-HELPER[' . __METHOD__ . ':' . __LINE__ . ']: chunkHashes[]=' . count($chunkHashes) . ',chunkData[]=' . count($chunkData));
+               //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__)->debugOutput('chunkData='.print_r($chunkData, TRUE));
                if ((isset($chunkHashes[0])) && (isset($chunkData[0]))) {
                        // Remember this chunk as queued
                        $this->queuedChunks[$chunkHashes[0]] = $chunkData[0];
 
                        // Return the raw data
-                       //* NOISY-DEBUG: */ $this->debugOutput('CONNECTION: Returning ' . strlen($chunkData[0]) . ' bytes from ' . __METHOD__ . ' ...');
+                       //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__)->debugOutput('CONNECTION-HELPER[' . __METHOD__ . ':' . __LINE__ . ']: Returning ' . strlen($chunkData[0]) . ' bytes from ' . __METHOD__ . ' ...');
                        return $chunkData[0];
                } else {
                        // Return zero string
-                       //* NOISY-DEBUG: */ $this->debugOutput('CONNECTION: Returning zero bytes from ' . __METHOD__ . '!');
+                       //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__)->debugOutput('CONNECTION-HELPER[' . __METHOD__ . ':' . __LINE__ . ']: Returning zero bytes from ' . __METHOD__ . '!');
                        return '';
                }
        }
@@ -349,94 +372,70 @@ class BaseConnectionHelper extends BaseHubHelper implements Registerable, Protoc
         * Sends raw package data to the recipient
         *
         * @param       $packageData            Raw package data
-        * @return      $totalSentBytes         Total sent bytes to the peer
+        * @return      void
         * @throws      InvalidSocketException  If we got a problem with this socket
         */
        public function sendRawPackageData (array $packageData) {
                // The helper's state must be 'connected'
                $this->getStateInstance()->validatePeerStateConnected();
 
-               // Cache buffer length
-               $bufferSize = $this->getConfigInstance()->getConfigEntry($this->getProtocol() . '_buffer_length');
+               // Implode the package data array and fragement the resulting string, returns the final hash
+               $finalHash = $this->getFragmenterInstance()->fragmentPackageArray($packageData, $this);
+
+               // Is the final hash set?
+               if ($finalHash !== TRUE) {
+                       // Debug message
+                       //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__)->debugOutput('CONNECTION-HELPER[' . __METHOD__ . ':' . __LINE__ . ']: Setting finalHash=' . $finalHash . ',currentFinalHash[' . gettype($this->currentFinalHash) . ']=' . $this->currentFinalHash);
+
+                       // Set final hash
+                       $this->currentFinalHash = $finalHash;
+               } // END - if
+
+               // Reset serial number
+               $this->getFragmenterInstance()->resetSerialNumber($this->currentFinalHash);
 
                // Init variables
                $rawData        = '';
                $dataStream     = ' ';
-               $totalSentBytes = 0;
 
                // Fill sending buffer with data
                while (strlen($dataStream) > 0) {
+                       // Debug message
+                       //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__)->debugOutput('CONNECTION-HELPER[' . __METHOD__ . ':' . __LINE__ . ']: packageData=' . print_r($packageData, TRUE));
+
                        // Convert the package data array to a raw data stream
                        $dataStream = $this->getRawDataFromPackageArray($packageData);
-                       //* NOISY-DEBUG: */ $this->debugOutput('CONNECTION: Adding ' . strlen($dataStream) . ' bytes to the sending buffer ...');
+                       //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__)->debugOutput('CONNECTION-HELPER[' . __METHOD__ . ':' . __LINE__ . ']: Adding ' . strlen($dataStream) . ' bytes to the sending buffer ...');
                        $rawData .= $dataStream;
                } // END - while
-               //* NOISY-DEBUG: */ $this->debugOutput('CONNECTION: rawData[' . strlen($rawData) . ']=' . $rawData);
 
                // Nothing to sent is bad news, so assert on it
                assert(strlen($rawData) > 0);
 
+               // Calculate buffer size
+               $bufferSize = $this->getConfigInstance()->getConfigEntry($this->getProtocol() . '_buffer_length');
+
                // Encode the raw data with our output-stream
                $encodedData = $this->getOutputStreamInstance()->streamData($rawData);
 
-               // Calculate difference
-               $this->diff = $bufferSize - strlen($encodedData);
-
-               // Get socket resource
-               $socketResource = $this->getSocketResource();
-
-               // Init sent bytes
-               $sentBytes = 0;
-
-               // Deliver all data
-               while ($sentBytes !== false) {
-                       // And deliver it
-                       //* NOISY-DEBUG: */ $this->debugOutput('CONNECTION: Sending out ' . strlen($encodedData) . ' bytes,bufferSize=' . $bufferSize . ',diff=' . $this->diff);
-                       if ($this->diff >= 0) {
-                               // Send all out (encodedData is smaller than or equal buffer size)
-                               $sentBytes = @socket_write($socketResource, $encodedData, ($bufferSize - $this->diff));
-                       } else {
-                               // Send buffer size out
-                               $sentBytes = @socket_write($socketResource, $encodedData, $bufferSize);
-                       }
-
-                       // If there was an error, we don't continue here
-                       if ($sentBytes === false) {
-                               // Handle the error with a faked recipientData array
-                               $this->handleSocketError($socketResource, array('0.0.0.0', '0'));
-
-                               // And throw it
-                               throw new InvalidSocketException(array($this, $socketResource, $socketError, $errorMessage), BaseListener::EXCEPTION_INVALID_SOCKET);
-                       } elseif (($sentBytes == 0) && (strlen($encodedData) > 0)) {
-                               // Nothing sent means we are done
-                               //* NOISY-DEBUG: */ $this->debugOutput('CONNECTION: All sent! (LINE=' . __LINE__ . ')');
-                               break;
-                       }
-
-                       // The difference between sent bytes and length of raw data should not go below zero
-                       assert((strlen($encodedData) - $sentBytes) >= 0);
-
-                       // Add total sent bytes
-                       $totalSentBytes += $sentBytes;
-
-                       // Cut out the last unsent bytes
-                       //* NOISY-DEBUG: */ $this->debugOutput('CONNECTION: Sent out ' . $sentBytes . ' of ' . strlen($encodedData) . ' bytes ...');
-                       $encodedData = substr($encodedData, $sentBytes);
-
-                       // Calculate difference again
-                       $this->diff = $bufferSize - strlen($encodedData);
+               // Debug message
+               //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__)->debugOutput('HELPER[' . __METHOD__ . ':' . __LINE__ . ']: socketResource[]=' . gettype($this->getSocketResource()) . PHP_EOL);
+
+               // Init array
+               $encodedDataArray = array(
+                       NetworkPackage::RAW_FINAL_HASH_INDEX   => $this->currentFinalHash,
+                       NetworkPackage::RAW_ENCODED_DATA_INDEX => $encodedData,
+                       NetworkPackage::RAW_SENT_BYTES_INDEX   => 0,
+                       NetworkPackage::RAW_SOCKET_INDEX       => $this->getSocketResource(),
+                       NetworkPackage::RAW_BUFFER_SIZE_INDEX  => $bufferSize,
+                       NetworkPackage::RAW_DIFF_INDEX         => 0
+               );
 
-                       // Can we abort?
-                       if (strlen($encodedData) <= 0) {
-                               // Abort here, all sent!
-                               //* NOISY-DEBUG: */ $this->debugOutput('CONNECTION: All sent! (LINE=' . __LINE__ . ')');
-                               break;
-                       } // END - if
-               } // END - while
+               // Calculate difference
+               $diff = $encodedDataArray[NetworkPackage::RAW_BUFFER_SIZE_INDEX] - strlen($encodedDataArray[NetworkPackage::RAW_ENCODED_DATA_INDEX]);
 
-               // Return sent bytes
-               //* NOISY-DEBUG: */ $this->debugOutput('CONNECTION: totalSentBytes=' . $totalSentBytes . ',diff=' . $this->diff);
-               return $totalSentBytes;
+               // Push raw data to the package's outgoing stack
+               $this->getPackageInstance()->getStackInstance()->pushNamed(NetworkPackage::STACKER_NAME_OUTGOING_STREAM, $encodedDataArray);
        }
 
        /**
@@ -445,11 +444,11 @@ class BaseConnectionHelper extends BaseHubHelper implements Registerable, Protoc
         * @return      void
         */
        protected final function markConnectionShuttedDown () {
-               //* NOISY-DEBUG: */ $this->debugOutput('CONNECTION: ' . $this->__toString() . ' has been marked as shutted down');
-               $this->shuttedDown = true;
+               //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__)->debugOutput('CONNECTION-HELPER[' . __METHOD__ . ':' . __LINE__ . ']: ' . $this->__toString() . ' has been marked as shutted down');
+               $this->shuttedDown = TRUE;
 
                // And remove the (now invalid) socket
-               $this->setSocketResource(false);
+               $this->setSocketResource(FALSE);
        }
 
        /**
@@ -458,7 +457,7 @@ class BaseConnectionHelper extends BaseHubHelper implements Registerable, Protoc
         * @return      $shuttedDown    Whether this connection is shutted down
         */
        public final function isShuttedDown () {
-               //* NOISY-DEBUG: */ $this->debugOutput('CONNECTION: ' . $this->__toString() . ',shuttedDown=' . intval($this->shuttedDown));
+               //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__)->debugOutput('CONNECTION-HELPER[' . __METHOD__ . ':' . __LINE__ . ']: ' . $this->__toString() . ',shuttedDown=' . intval($this->shuttedDown));
                return $this->shuttedDown;
        }
 
@@ -471,10 +470,11 @@ class BaseConnectionHelper extends BaseHubHelper implements Registerable, Protoc
         * later debugging purposes.
         *
         * @param       $socketResource         A valid socket resource
+        * @param       $recipientData          An array with two elements: 0=IP number, 1=port number
         * @return      void
         * @throws      SocketConnectionException       The connection attempts fails with a time-out
         */
-       protected function socketErrorConnectionTimedOutHandler ($socketResource) {
+       protected function socketErrorConnectionTimedOutHandler ($socketResource, array $recipientData) {
                // Get socket error code for verification
                $socketError = socket_last_error($socketResource);
 
@@ -493,10 +493,11 @@ class BaseConnectionHelper extends BaseHubHelper implements Registerable, Protoc
         * clear it for later debugging purposes.
         *
         * @param       $socketResource         A valid socket resource
+        * @param       $recipientData          An array with two elements: 0=IP number, 1=port number
         * @return      void
         * @throws      SocketConnectionException       The connection attempts fails with a time-out
         */
-       protected function socketErrorResourceUnavailableHandler ($socketResource) {
+       protected function socketErrorResourceUnavailableHandler ($socketResource, array $recipientData) {
                // Get socket error code for verification
                $socketError = socket_last_error($socketResource);
 
@@ -515,10 +516,11 @@ class BaseConnectionHelper extends BaseHubHelper implements Registerable, Protoc
         * later debugging purposes.
         *
         * @param       $socketResource         A valid socket resource
+        * @param       $recipientData          An array with two elements: 0=IP number, 1=port number
         * @return      void
         * @throws      SocketConnectionException       The connection attempts fails with a time-out
         */
-       protected function socketErrorConnectionRefusedHandler ($socketResource) {
+       protected function socketErrorConnectionRefusedHandler ($socketResource, array $recipientData) {
                // Get socket error code for verification
                $socketError = socket_last_error($socketResource);
 
@@ -537,10 +539,11 @@ class BaseConnectionHelper extends BaseHubHelper implements Registerable, Protoc
         * debugging purposes.
         *
         * @param       $socketResource         A valid socket resource
+        * @param       $recipientData          An array with two elements: 0=IP number, 1=port number
         * @return      void
         * @throws      SocketConnectionException       The connection attempts fails with a time-out
         */
-       protected function socketErrorNoRouteToHostHandler ($socketResource) {
+       protected function socketErrorNoRouteToHostHandler ($socketResource, array $recipientData) {
                // Get socket error code for verification
                $socketError = socket_last_error($socketResource);
 
@@ -556,14 +559,15 @@ class BaseConnectionHelper extends BaseHubHelper implements Registerable, Protoc
 
        /**
         * Handles socket error 'operation already in progress' which happens in
-        * method connectToPeerByRecipientDataArray() on timed out connection
+        * method connectToPeerByRecipientData() on timed out connection
         * attempts.
         *
         * @param       $socketResource         A valid socket resource
+        * @param       $recipientData          An array with two elements: 0=IP number, 1=port number
         * @return      void
         * @throws      SocketConnectionException       The connection attempts fails with a time-out
         */
-       protected function socketErrorOperationAlreadyProgressHandler ($socketResource) {
+       protected function socketErrorOperationAlreadyProgressHandler ($socketResource, array $recipientData) {
                // Get socket error code for verification
                $socketError = socket_last_error($socketResource);
 
@@ -577,15 +581,39 @@ class BaseConnectionHelper extends BaseHubHelper implements Registerable, Protoc
                throw new SocketConnectionException(array($this, $socketResource, $socketError, $errorMessage), BaseListener::EXCEPTION_INVALID_SOCKET);
        }
 
+       /**
+        * Handles socket error 'connection reset by peer', but does not clear it for
+        * later debugging purposes.
+        *
+        * @param       $socketResource         A valid socket resource
+        * @param       $recipientData          An array with two elements: 0=IP number, 1=port number
+        * @return      void
+        * @throws      SocketConnectionException       The connection attempts fails with a time-out
+        */
+       protected function socketErrorConnectionResetByPeerHandler ($socketResource, array $recipientData) {
+               // Get socket error code for verification
+               $socketError = socket_last_error($socketResource);
+
+               // Get error message
+               $errorMessage = socket_strerror($socketError);
+
+               // Shutdown this socket
+               $this->shutdownSocket($socketResource);
+
+               // Throw it again
+               throw new SocketConnectionException(array($this, $socketResource, $socketError, $errorMessage), BaseListener::EXCEPTION_INVALID_SOCKET);
+       }
+
        /**
         * Handles socket "error" 'operation now in progress' which can be safely
         * passed on with non-blocking connections.
         *
         * @param       $socketResource         A valid socket resource
+        * @param       $recipientData          An array with two elements: 0=IP number, 1=port number
         * @return      void
         */
-       protected function socketErrorOperationInProgressHandler ($socketResource) {
-               $this->debugOutput('CONNECTION: Operation is now in progress, this is usual for non-blocking connections and is no bug.');
+       protected function socketErrorOperationInProgressHandler ($socketResource, array $recipientData) {
+               self::createDebugInstance(__CLASS__)->debugOutput('CONNECTION-HELPER[' . __METHOD__ . ':' . __LINE__ . ']: Operation is now in progress, this is usual for non-blocking connections and is no bug.');
        }
 }