From 96366cb92e22e4c9b466186af7f6941127d696e8 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Roland=20H=C3=A4der?= Date: Sat, 20 May 2017 00:36:50 +0200 Subject: [PATCH] Continued: - Let's log the error code, too! - renamed method to getLastSocketError() MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit Signed-off-by: Roland Häder --- application/hub/classes/class_BaseHubSystem.php | 4 ++-- .../recipient/socket/class_PackageSocketDiscovery.php | 2 +- .../hub/classes/factories/socket/class_SocketFactory.php | 2 +- application/hub/classes/listener/class_BaseListener.php | 4 ++-- 4 files changed, 6 insertions(+), 6 deletions(-) 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(); -- 2.39.5