]> git.mxchange.org Git - hub.git/blobdiff - application/hub/main/listener/tcp/class_TcpListener.php
'public static final' is the right thing, some variables renamed to make clear what...
[hub.git] / application / hub / main / listener / tcp / class_TcpListener.php
index 6cbe71b3b6e3f63cc54926ff93caeba08d7c4d16..a040861db22e499feda5232598d55dc67441ea45 100644 (file)
@@ -38,7 +38,7 @@ class TcpListener extends BaseListener implements Listenable {
         * @param       $nodeInstance           A NodeHelper instance
         * @return      $listenerInstance       An instance a prepared listener class
         */
-       public final static function createTcpListener (NodeHelper $nodeInstance) {
+       public static final function createTcpListener (NodeHelper $nodeInstance) {
                // Get new instance
                $listenerInstance = new TcpListener();
 
@@ -175,6 +175,7 @@ class TcpListener extends BaseListener implements Listenable {
         * "Listens" for incoming network packages
         *
         * @return      void
+        * @throws      InvalidSocketException  If an invalid socket resource has been found
         */
        public function doListen () {
                // Get all readers
@@ -213,7 +214,7 @@ class TcpListener extends BaseListener implements Listenable {
                                // Shutdown this socket
                                $this->shutdownSocket($newSocket);
 
-                               // And throw again
+                               // And throw the exception
                                throw new InvalidSocketException(array($this, gettype($newSocket), $socketError, $errorMessage), BaseListener::EXCEPTION_INVALID_SOCKET);
                        } // END - if
 
@@ -228,12 +229,12 @@ class TcpListener extends BaseListener implements Listenable {
                } // END - if
 
                // Get the current value
-               $current = $this->getIteratorInstance()->current();
+               $currentSocket = $this->getIteratorInstance()->current();
 
                // Handle it here, if not main socket
-               if ($current != $this->getSocketResource()) {
+               if ($currentSocket != $this->getSocketResource()) {
                        // ... or else it will raise warnings like 'Transport endpoint is not connected'
-                       $this->getPackageInstance()->processResourcePackage($current);
+                       $this->getPackageInstance()->processResourcePackage($currentSocket);
                } // END - if
 
                // Advance to next entry. This should be the last line