]> git.mxchange.org Git - hub.git/blobdiff - application/hub/main/listener/tcp/class_TcpListener.php
Introduced self::createDebugInstance()
[hub.git] / application / hub / main / listener / tcp / class_TcpListener.php
index 8c8afa8908faed81aad0136cc2c701a6a433c985..bebe4e1e50f64490ca6fe1e09b736ad10041f281 100644 (file)
@@ -105,7 +105,7 @@ class TcpListener extends BaseListener implements Listenable {
                 * that all connections on this port are now our resposibility to
                 * send/recv data, disconnect, etc..
                 */
-               $this->debugOutput('TCP-LISTENER: Binding to address ' . $this->getListenAddress() . ':' . $this->getListenPort());
+               self::createDebugInstance(__CLASS__)->debugOutput('TCP-LISTENER: Binding to address ' . $this->getListenAddress() . ':' . $this->getListenPort());
                if (!socket_bind($mainSocket, $this->getListenAddress(), $this->getListenPort())) {
                        // Handle this socket error with a faked recipientData array
                        $this->handleSocketError(__METHOD__, __LINE__, $mainSocket, array('0.0.0.0', '0'));
@@ -125,7 +125,7 @@ class TcpListener extends BaseListener implements Listenable {
                } // END - if
 
                // Start listen for connections
-               $this->debugOutput('TCP-LISTENER: Listening for connections.');
+               self::createDebugInstance(__CLASS__)->debugOutput('TCP-LISTENER: Listening for connections.');
                if (!socket_listen($mainSocket)) {
                        // Handle this socket error with a faked recipientData array
                        $this->handleSocketError(__METHOD__, __LINE__, $mainSocket, array('0.0.0.0', '0'));
@@ -145,7 +145,7 @@ class TcpListener extends BaseListener implements Listenable {
                } // END - if
 
                // Now, we want non-blocking mode
-               $this->debugOutput('TCP-LISTENER: Setting non-blocking mode.');
+               self::createDebugInstance(__CLASS__)->debugOutput('TCP-LISTENER: Setting non-blocking mode.');
                if (!socket_set_nonblock($mainSocket)) {
                        // Handle this socket error with a faked recipientData array
                        $this->handleSocketError(__METHOD__, __LINE__, $mainSocket, array('0.0.0.0', '0'));
@@ -190,7 +190,7 @@ class TcpListener extends BaseListener implements Listenable {
                $this->setHandlerInstance($handlerInstance);
 
                // Output message
-               $this->debugOutput('TCP-LISTENER: TCP listener now ready on IP ' . $this->getListenAddress() . ', port ' . $this->getListenPort() . ' for service.');
+               self::createDebugInstance(__CLASS__)->debugOutput('TCP-LISTENER: TCP listener now ready on IP ' . $this->getListenAddress() . ', port ' . $this->getListenPort() . ' for service.');
        }
 
        /**
@@ -217,14 +217,14 @@ class TcpListener extends BaseListener implements Listenable {
                // Some new peers found?
                if ($left < 1) {
                        // Debug message
-                       //* EXTREME-NOISY-DEBUG: */ $this->debugOutput('TCP-LISTENER: left=' . $left . ',serverSocket=' . $this->getSocketResource() . ',readers=' . print_r($readers, true));
+                       //* EXTREME-NOISY-DEBUG: */ self::createDebugInstance(__CLASS__)->debugOutput('TCP-LISTENER: left=' . $left . ',serverSocket=' . $this->getSocketResource() . ',readers=' . print_r($readers, true));
 
                        // Nothing new found
                        return;
                } // END - if
 
                // Debug message
-               //* NOISY-DEBUG: */ $this->debugOutput('TCP-LISTENER: serverSocket=' . $this->getSocketResource() . ',readers=' . print_r($readers, true));
+               //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__)->debugOutput('TCP-LISTENER: serverSocket=' . $this->getSocketResource() . ',readers=' . print_r($readers, true));
 
                // Do we have changed peers?
                if (in_array($this->getSocketResource(), $readers)) {
@@ -238,7 +238,7 @@ class TcpListener extends BaseListener implements Listenable {
                        $newSocket = socket_accept($this->getSocketResource());
 
                        // Debug message
-                       /* NOISY-DEBUG: */ $this->debugOutput('[' . __METHOD__ . ':' . __LINE__ . ']: newSocket=' . $newSocket . ',serverSocket=' .$this->getSocketResource());
+                       /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__)->debugOutput('[' . __METHOD__ . ':' . __LINE__ . ']: newSocket=' . $newSocket . ',serverSocket=' .$this->getSocketResource());
 
                        // Array for timeout settings
                        $options  = array(
@@ -258,7 +258,7 @@ class TcpListener extends BaseListener implements Listenable {
                        // Output result (only for debugging!)
                        /*
                        $option = socket_get_option($newSocket, SOL_SOCKET, SO_RCVTIMEO);
-                       $this->debugOutput('SO_RCVTIMEO[' . gettype($option) . ']=' . print_r($option, true));
+                       self::createDebugInstance(__CLASS__)->debugOutput('SO_RCVTIMEO[' . gettype($option) . ']=' . print_r($option, true));
                        */
 
                        // Enable SO_OOBINLINE
@@ -307,7 +307,7 @@ class TcpListener extends BaseListener implements Listenable {
                $currentSocket = $this->getIteratorInstance()->current();
 
                // Handle it here, if not main server socket
-               //* NOISY-DEBUG: */ $this->debugOutput('TCP-LISTENER: currentSocket=' . $currentSocket[BasePool::SOCKET_ARRAY_RESOURCE] . ',type=' . $currentSocket[BasePool::SOCKET_ARRAY_CONN_TYPE] . ',serverSocket=' . $this->getSocketResource());
+               //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__)->debugOutput('TCP-LISTENER: currentSocket=' . $currentSocket[BasePool::SOCKET_ARRAY_RESOURCE] . ',type=' . $currentSocket[BasePool::SOCKET_ARRAY_CONN_TYPE] . ',serverSocket=' . $this->getSocketResource());
                if (($currentSocket[BasePool::SOCKET_ARRAY_CONN_TYPE] != BaseConnectionHelper::CONNECTION_TYPE_SERVER) && ($currentSocket[BasePool::SOCKET_ARRAY_RESOURCE] != $this->getSocketResource())) {
                        // ... or else it will raise warnings like 'Transport endpoint is not connected'
                        $this->getHandlerInstance()->processRawDataFromResource($currentSocket);