From: Roland Häder Date: Fri, 19 May 2017 22:36:50 +0000 (+0200) Subject: Continued: X-Git-Url: https://git.mxchange.org/?a=commitdiff_plain;h=96366cb92e22e4c9b466186af7f6941127d696e8;p=hub.git Continued: - Let's log the error code, too! - renamed method to getLastSocketError() Signed-off-by: Roland Häder --- diff --git a/application/hub/classes/class_BaseHubSystem.php b/application/hub/classes/class_BaseHubSystem.php index 5c2f329ed..e81113d92 100644 --- a/application/hub/classes/class_BaseHubSystem.php +++ b/application/hub/classes/class_BaseHubSystem.php @@ -144,7 +144,7 @@ class BaseHubSystem extends BaseFrameworkSystem implements HubInterface { */ public final function handleSocketError ($method, $line, StorableSocket $socketInstance, array $socketData) { // Trace message - /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('HUB-SYSTEM: CALLED!'); + /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput(sprintf('HUB-SYSTEM: Handling socket errorCode=%d - CALLED!', $socketInstance->getLastSocketError())); // This method handles only socket resources if (!$socketInstance->isValidSocket()) { @@ -158,7 +158,7 @@ class BaseHubSystem extends BaseFrameworkSystem implements HubInterface { assert(isset($socketData[1])); // Get error code for first validation (0 is not an error) - $errorCode = $socketInstance->getSocketLastError(); + $errorCode = $socketInstance->getLastSocketError(); // If the error code is zero, someone called this method without an error if ($errorCode == 0) { diff --git a/application/hub/classes/discovery/recipient/socket/class_PackageSocketDiscovery.php b/application/hub/classes/discovery/recipient/socket/class_PackageSocketDiscovery.php index ac471d66a..c08c97f1a 100644 --- a/application/hub/classes/discovery/recipient/socket/class_PackageSocketDiscovery.php +++ b/application/hub/classes/discovery/recipient/socket/class_PackageSocketDiscovery.php @@ -176,7 +176,7 @@ class PackageSocketDiscovery extends BaseRecipientDiscovery implements Discovera /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugInstance(__CLASS__, __LINE__)->debugOutput(sprintf('SOCKET-DISCOVERY: socketInstance[]=%s', gettype($socketInstance))); // Is it FALSE, the recipient isn't known to us and we have no connection to it - if (($socketInstance instanceof StorableSocket) || (!$socketInstance->isValidSocket()) || ($socketInstance->getSocketLastError() > 0)) { + if (($socketInstance instanceof StorableSocket) || (!$socketInstance->isValidSocket()) || ($socketInstance->getLastSocketError() > 0)) { // Try to create a new socket resource try { // Possibly noisy debug message diff --git a/application/hub/classes/factories/socket/class_SocketFactory.php b/application/hub/classes/factories/socket/class_SocketFactory.php index 718e6b1ac..297342a5b 100644 --- a/application/hub/classes/factories/socket/class_SocketFactory.php +++ b/application/hub/classes/factories/socket/class_SocketFactory.php @@ -141,7 +141,7 @@ class SocketFactory extends ObjectFactory { } // END - if // Get socket error code for verification - $socketError = $socketInstance->getSocketLastError(); + $socketError = $socketInstance->getLastSocketError(); // Check if there was an error else if ($socketError > 0) { diff --git a/application/hub/classes/listener/class_BaseListener.php b/application/hub/classes/listener/class_BaseListener.php index 89db507ed..fa72d314e 100644 --- a/application/hub/classes/listener/class_BaseListener.php +++ b/application/hub/classes/listener/class_BaseListener.php @@ -525,10 +525,10 @@ class BaseListener extends BaseHubSystem implements Visitable { */ protected function socketErrorPermissionDeniedHandler (StorableSocket $socketInstance, array $socketData) { // Get socket error code for verification - $socketError = $socketInstance->getSocketLastError(); + $socketError = $socketInstance->getLastSocketError(); // Get error message - $errorMessage = $socketInstance->getSocketLastErrorMessage(); + $errorMessage = $socketInstance->getLastSocketErrorMessage(); // Shutdown this socket $socketInstance->shutdownSocket();