]> git.mxchange.org Git - hub.git/commitdiff
shutdownSocket() method stub added
authorRoland Häder <roland@mxchange.org>
Wed, 8 Jul 2009 19:58:49 +0000 (19:58 +0000)
committerRoland Häder <roland@mxchange.org>
Wed, 8 Jul 2009 19:58:49 +0000 (19:58 +0000)
application/hub/main/listener/tcp/class_TcpListener.php
application/hub/main/pools/client/class_DefaultClientPool.php

index 9e6f3f86653acea6e06d45e5717a5f8296939549..f9fc6214242b7dd6db1b872f9388c490c0102089 100644 (file)
@@ -82,8 +82,14 @@ class TcpListener extends BaseListener implements Listenable {
                        // Get socket error code for verification
                        $socketError = socket_last_error($mainSocket);
 
+                       // Get error message
+                       $errorMessage = socket_strerror($socketError);
+
+                       // Shutdown this socket
+                       $this->shutdownSocket($mainSocket);
+
                        // And throw again
-                       throw new InvalidSocketException(array($this, gettype($mainSocket), $socketError, socket_strerror($socketError)), BaseListener::EXCEPTION_INVALID_SOCKET);
+                       throw new InvalidSocketException(array($this, gettype($mainSocket), $socketError, $errorMessage), BaseListener::EXCEPTION_INVALID_SOCKET);
                } // END - if
 
                // "Bind" the socket to the given address, on given port so this means
@@ -93,8 +99,14 @@ class TcpListener extends BaseListener implements Listenable {
                        // Get socket error code for verification
                        $socketError = socket_last_error($mainSocket);
 
+                       // Get error message
+                       $errorMessage = socket_strerror($socketError);
+
+                       // Shutdown this socket
+                       $this->shutdownSocket($mainSocket);
+
                        // And throw again
-                       throw new InvalidSocketException(array($this, gettype($mainSocket), $socketError, socket_strerror($socketError)), BaseListener::EXCEPTION_INVALID_SOCKET);
+                       throw new InvalidSocketException(array($this, gettype($mainSocket), $socketError, $errorMessage), BaseListener::EXCEPTION_INVALID_SOCKET);
                } // END - if
 
                // Start listen for connections
@@ -102,8 +114,14 @@ class TcpListener extends BaseListener implements Listenable {
                        // Get socket error code for verification
                        $socketError = socket_last_error($mainSocket);
 
+                       // Get error message
+                       $errorMessage = socket_strerror($socketError);
+
+                       // Shutdown this socket
+                       $this->shutdownSocket($mainSocket);
+
                        // And throw again
-                       throw new InvalidSocketException(array($this, gettype($mainSocket), $socketError, socket_strerror($socketError)), BaseListener::EXCEPTION_INVALID_SOCKET);
+                       throw new InvalidSocketException(array($this, gettype($mainSocket), $socketError, $errorMessage), BaseListener::EXCEPTION_INVALID_SOCKET);
                } // END - if
 
                // Set the main socket
index 9a2922e51a34ee8cb702908edc4dbde1d4f5021b..428f1d3400f8916d52a1525cc611000cf9905557 100644 (file)
@@ -68,8 +68,14 @@ class DefaultClientPool extends BasePool implements PoolableClient {
 
                // Is it without any errors?
                if ($errorCode > 0) {
-                       // Throw an exception again
-                       throw new InvalidSocketException(array($this, gettype($socketResource), $errorCode, socket_strerror($errorCode)), BaseListener::EXCEPTION_INVALID_SOCKET);
+                       // Get error message
+                       $errorMessage = socket_strerror($errorCode);
+
+                       // Shutdown this socket
+                       $this->getListenerInstance()->shutdownSocket($mainSocket);
+
+                       // And throw again
+                       throw new InvalidSocketException(array($this, gettype($mainSocket), $socketError, $errorMessage), BaseListener::EXCEPTION_INVALID_SOCKET);
                } // END - if
 
                // Add it finally to the pool