From 2de3092a14b96207fab3845398902dcfbccd074c Mon Sep 17 00:00:00 2001 From: =?utf8?q?Roland=20H=C3=A4der?= Date: Sun, 21 May 2017 15:05:48 +0200 Subject: [PATCH] Continued: - implemented clearLastSocketError() - renamed variables - removed duplicate field, now handled by any StorableSocket class - more fixes MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit Signed-off-by: Roland Häder --- .../socket/class_SocketContainer.php | 110 +++++++++--------- .../socket/class_PackageSocketDiscovery.php | 2 +- .../factories/socket/class_SocketFactory.php | 4 +- .../socket/class_SocketRawDataHandler.php | 5 - .../network/tcp/class_TcpRawDataHandler.php | 9 +- .../classes/handler/raw_data/network/class_ | 5 - .../classes/listener/class_BaseListener.php | 6 +- .../socket/class_SocketFileListener.php | 2 +- .../classes/package/class_NetworkPackage.php | 2 +- .../registry/socket/class_SocketRegistry.php | 2 +- .../socket/class_SocketShutdownException.php | 2 +- .../container/socket/class_StorableSocket.php | 13 +-- .../socket/class_RegisterableSocket.php | 9 +- 13 files changed, 76 insertions(+), 95 deletions(-) diff --git a/application/hub/classes/container/socket/class_SocketContainer.php b/application/hub/classes/container/socket/class_SocketContainer.php index 1ae9936a2..9197e73b1 100644 --- a/application/hub/classes/container/socket/class_SocketContainer.php +++ b/application/hub/classes/container/socket/class_SocketContainer.php @@ -174,6 +174,9 @@ class SocketContainer extends BaseContainer implements StorableSocket, Visitable // Check it $isServerSocket = (($this->isValidSocket()) && ($this->getSocketPeerName($peerAddress, $peerPort) === FALSE)); + // Debug message + /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput(sprintf('%s-SOCKET: isServerSocket=%d', strtoupper($this->getSocketProtocol()), intval($isServerSocket))); + // Need to clear the error here if it is a resource if ($isServerSocket === true) { // Clear the error @@ -182,10 +185,10 @@ class SocketContainer extends BaseContainer implements StorableSocket, Visitable } // END - if // Debug message - /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput(sprintf(strtoupper($this->getSocketProtocol()) . '-SOCKET: peerAddress=%s,peerPort=%d', $peerAddress, $peerPort)); + /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput(sprintf('%s-SOCKET: peerAddress=%s,peerPort=%d', strtoupper($this->getSocketProtocol()), $peerAddress, $peerPort)); // Check peer name, it must be empty - $isServerSocket = (($isServerSocket) && (empty($peerAddress))); + // @TODO: $isServerSocket = (($isServerSocket) && ($peerAddress === '0.0.0.0') && ($peerPort === '0')); // Trace message /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput(sprintf(strtoupper($this->getSocketProtocol()) . '-SOCKET: isServerSocket=%d - EXIT!', intval($isServerSocket))); @@ -260,6 +263,9 @@ class SocketContainer extends BaseContainer implements StorableSocket, Visitable * @throws InvalidSocketException If socket is invalid */ public function getSocketPeerName (&$peerAddress, &$peerPort) { + // Trace message + /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput(sprintf('%s-SOCKET: peerAddress=%s,peerPort=%d - CALLED!', strtoupper($this->getSocketProtocol()), $peerAddress, $peerPort)); + // Should be valid socket if (!$this->isValidSocket()) { // Throw exception @@ -274,7 +280,7 @@ class SocketContainer extends BaseContainer implements StorableSocket, Visitable * support socket_getpeername(): * http://de2.php.net/manual/en/function.socket-getpeername.php#35656 */ - if ($this->getSocketType() == 'udp') { + if ($this->getSocketProtocol() == 'udp') { // UDP is WIP: $this->partialStub('UDP sockets are unfinished.'); } else { @@ -282,6 +288,9 @@ class SocketContainer extends BaseContainer implements StorableSocket, Visitable $result = socket_getpeername($this->getSocketResource(), $peerAddress, $peerPort); } + // Trace message + /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput(sprintf('%s-SOCKET: peerAddress=%s,peerPort=%d,result[%s]=%d - EXIT!', strtoupper($this->getSocketProtocol()), $peerAddress, $peerPort, gettype($result), intval($result))); + // Return result return $result; } @@ -296,38 +305,6 @@ class SocketContainer extends BaseContainer implements StorableSocket, Visitable return $this->socketProtocol; } - /** - * Some "getter" for socket type of stored socket - * - * @return $socketType Socket type - * @throws InvalidSocketException If socket is invalid - */ - public function getSocketType () { - // Should be valid socket - if (!$this->isValidSocket()) { - // Throw exception - throw new InvalidSocketException(array($this, $this->getSocketResource()), self::EXCEPTION_INVALID_SOCKET); - } // END - if - - // Get socket protocol first - $socketProtocol = $this->getSocketProtocol(); - - // Debug message - /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput(sprintf(strtoupper($this->getSocketProtocol()) . '-SOCKET: socketProtocol[%s]=%s', gettype($socketProtocol), $socketProtocol)); - - // Get socket option - $socketType = socket_get_option($this->getSocketResource(), getprotobyname($socketProtocol), SO_TYPE); - - // Debug message - /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput(sprintf(strtoupper($this->getSocketProtocol()) . '-SOCKET: socketType[%s]=%s', gettype($socketType), $socketType)); - - // Is it valid? - if ($socketType === FALSE) { - // Something went wrong - $this->handleSocketError(__METHOD__, __LINE__, array('null', '0')); - } // END - if - } - /** * Validates stored stocket * @@ -346,12 +323,12 @@ class SocketContainer extends BaseContainer implements StorableSocket, Visitable } /** - * Getter for last socket error + * Getter for last socket error code * - * @return $lastSocketError Last socket error + * @return $errorCode Last socket error * @throws InvalidSocketException If socket is invalid */ - public function getLastSocketError () { + public function getLastSocketErrorCode () { // Should be valid socket if (!$this->isValidSocket()) { // Throw exception @@ -371,7 +348,7 @@ class SocketContainer extends BaseContainer implements StorableSocket, Visitable /** * Getter for last socket error message * - * @return $lastSocketErrorMessage Last socket error message + * @return $errorMessage Last socket error message * @throws InvalidSocketException If socket is invalid */ public function getLastSocketErrorMessage () { @@ -385,10 +362,10 @@ class SocketContainer extends BaseContainer implements StorableSocket, Visitable $socketResource = $this->getSocketResource(); // Get error code and message - $message = socket_strerror(socket_last_error($socketResource)); + $errorMessage = socket_strerror(socket_last_error($socketResource)); // Return it - return $message; + return $errorMessage; } /** @@ -463,7 +440,7 @@ class SocketContainer extends BaseContainer implements StorableSocket, Visitable */ public function doShutdown () { // Debug message - self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('HELPER: Shutting down socket ' . $this->getSocketResource()); + self::createDebugInstance(__CLASS__, __LINE__)->debugOutput(strtoupper($this->getSocketProtocol()) . '-SOCKET: Shutting down socket ' . $this->getSocketResource()); $this->partialStub('Please rewrite this method.'); return; @@ -508,7 +485,7 @@ class SocketContainer extends BaseContainer implements StorableSocket, Visitable */ public final function handleSocketError ($method, $line, array $socketData) { // Trace message - /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput(sprintf('HUB-SYSTEM: Handling socket errorCode=%d - CALLED!', $this->getLastSocketError())); + /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput(sprintf('HUB-SYSTEM: Handling socket errorCode=%d - CALLED!', $this->getLastSocketErrorCode())); // This method handles only socket resources if (!$this->isValidSocket()) { @@ -522,7 +499,7 @@ class SocketContainer extends BaseContainer implements StorableSocket, Visitable assert(isset($socketData[1])); // Get error code for first validation (0 is not an error) - $errorCode = $this->getLastSocketError(); + $errorCode = $this->getLastSocketErrorCode(); // If the error code is zero, someone called this method without an error if ($errorCode == 0) { @@ -576,7 +553,7 @@ class SocketContainer extends BaseContainer implements StorableSocket, Visitable */ protected function handleSocketErrorPermissionDenied (array $socketData) { // Get socket error code for verification - $socketError = $this->getLastSocketError(); + $socketError = $this->getLastSocketErrorCode(); // Get error message $errorMessage = $this->getLastSocketErrorMessage(); @@ -598,7 +575,7 @@ class SocketContainer extends BaseContainer implements StorableSocket, Visitable */ protected function handleSocketErrorConnectionTimedOut (array $socketData) { // Get socket error code for verification - $socketError = $this->getLastSocketError(); + $socketError = $this->getLastSocketErrorCode(); // Get error message $errorMessage = $this->getLastSocketErrorMessage(); @@ -620,7 +597,7 @@ class SocketContainer extends BaseContainer implements StorableSocket, Visitable */ protected function handleSocketErrorResourceUnavailable (array $socketData) { // Get socket error code for verification - $socketError = $this->getLastSocketError(); + $socketError = $this->getLastSocketErrorCode(); // Get error message $errorMessage = $this->getLastSocketErrorMessage(); @@ -642,7 +619,7 @@ class SocketContainer extends BaseContainer implements StorableSocket, Visitable */ protected function handleSocketErrorConnectionRefused (array $socketData) { // Get socket error code for verification - $socketError = $this->getLastSocketError(); + $socketError = $this->getLastSocketErrorCode(); // Get error message $errorMessage = $this->getLastSocketErrorMessage(); @@ -664,7 +641,7 @@ class SocketContainer extends BaseContainer implements StorableSocket, Visitable */ protected function handleSocketErrorNoRouteToHost (array $socketData) { // Get socket error code for verification - $socketError = $this->getLastSocketError(); + $socketError = $this->getLastSocketErrorCode(); // Get error message $errorMessage = $this->getLastSocketErrorMessage(); @@ -687,7 +664,7 @@ class SocketContainer extends BaseContainer implements StorableSocket, Visitable */ protected function handleSocketErrorOperationAlreadyProgress (array $socketData) { // Get socket error code for verification - $socketError = $this->getLastSocketError(); + $socketError = $this->getLastSocketErrorCode(); // Get error message $errorMessage = $this->getLastSocketErrorMessage(); @@ -709,7 +686,7 @@ class SocketContainer extends BaseContainer implements StorableSocket, Visitable */ protected function handleSocketErrorConnectionResetByPeer (array $socketData) { // Get socket error code for verification - $socketError = $this->getLastSocketError(); + $socketError = $this->getLastSocketErrorCode(); // Get error message $errorMessage = $this->getLastSocketErrorMessage(); @@ -731,7 +708,7 @@ class SocketContainer extends BaseContainer implements StorableSocket, Visitable */ protected function handleSocketErrorOperationNotSupported (array $socketData) { // Get socket error code for verification - $socketError = $this->getLastSocketError(); + $socketError = $this->getLastSocketErrorCode(); // Get error message $errorMessage = $this->getLastSocketErrorMessage(); @@ -751,7 +728,7 @@ class SocketContainer extends BaseContainer implements StorableSocket, Visitable * @return void */ protected function handleSocketErrorOperationInProgress (array $socketData) { - self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('CONNECTION-HELPER: Operation is now in progress, this is usual for non-blocking connections and is no bug.'); + self::createDebugInstance(__CLASS__, __LINE__)->debugOutput(strtoupper($this->getSocketProtocol()) . '-HELPER: Operation is now in progress, this is usual for non-blocking connections and is no bug.'); } /************************************************************************ @@ -843,4 +820,31 @@ class SocketContainer extends BaseContainer implements StorableSocket, Visitable $this->socketProtocol = $socketProtocol; } + /** + * Clears last socket error + * + * @return void + * @throws InvalidSocketException If stored socket is invalid + * @throws BadMethodCallException If no socket error was reported but method called + */ + private function clearLastSocketError () { + // Trace message + /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput(strtoupper($this->getSocketProtocol()) . '-SOCKET: Clearing socket error - CALLED!'); + + // Should be valid socket + if (!$this->isValidSocket()) { + // Throw exception + throw new InvalidSocketException(array($this, $this->getSocketResource()), self::EXCEPTION_INVALID_SOCKET); + } elseif ($this->getLastSocketErrorCode() === 0) { + // Nothing to clear + throw new BadMethodCallException(sprintf('Socket "%s" has no error reported, but method is called.', $this->getSocketResource())); + } + + // Clear last error + socket_clear_error($this->getSocketResource()); + + // Trace message + /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput(strtoupper($this->getSocketProtocol()) . '-SOCKET: Error cleared - EXIT!'); + } + } diff --git a/application/hub/classes/discovery/recipient/socket/class_PackageSocketDiscovery.php b/application/hub/classes/discovery/recipient/socket/class_PackageSocketDiscovery.php index 4a57ec5e4..22eb61829 100644 --- a/application/hub/classes/discovery/recipient/socket/class_PackageSocketDiscovery.php +++ b/application/hub/classes/discovery/recipient/socket/class_PackageSocketDiscovery.php @@ -177,7 +177,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->getLastSocketError() > 0)) { + if (($socketInstance instanceof StorableSocket) || (!$socketInstance->isValidSocket()) || ($socketInstance->getLastSocketErrorCode() > 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 df5577c58..4bec13a89 100644 --- a/application/hub/classes/factories/socket/class_SocketFactory.php +++ b/application/hub/classes/factories/socket/class_SocketFactory.php @@ -134,7 +134,7 @@ class SocketFactory extends ObjectFactory { } // END - if // Get socket error code for verification - $socketError = $socketInstance->getLastSocketError(); + $socketError = $socketInstance->getLastSocketErrorCode(); // Check if there was an error else if ($socketError > 0) { @@ -212,7 +212,7 @@ class SocketFactory extends ObjectFactory { } // END - if // Get socket error code for verification - $socketError = $socketInstance->getLastSocketError(); + $socketError = $socketInstance->getLastSocketErrorCode(); // Check if there was an error else if ($socketError > 0) { diff --git a/application/hub/classes/handler/network/socket/class_SocketRawDataHandler.php b/application/hub/classes/handler/network/socket/class_SocketRawDataHandler.php index 8ff54d60b..f60eba73e 100644 --- a/application/hub/classes/handler/network/socket/class_SocketRawDataHandler.php +++ b/application/hub/classes/handler/network/socket/class_SocketRawDataHandler.php @@ -29,11 +29,6 @@ use Hub\Network\Networkable; * along with this program. If not, see . */ class SocketRawDataHandler extends BaseRawDataHandler implements Networkable { - /** - * Last socket error (default: Success) - */ - private $lastSocketError = 0; - /** * Protected constructor * diff --git a/application/hub/classes/handler/network/tcp/class_TcpRawDataHandler.php b/application/hub/classes/handler/network/tcp/class_TcpRawDataHandler.php index 29a0a4545..460835bb6 100644 --- a/application/hub/classes/handler/network/tcp/class_TcpRawDataHandler.php +++ b/application/hub/classes/handler/network/tcp/class_TcpRawDataHandler.php @@ -30,11 +30,6 @@ use Hub\Pool\BasePool; * along with this program. If not, see . */ class TcpRawDataHandler extends BaseRawDataHandler implements Networkable { - /** - * Last socket error (default: Success) - */ - private $lastSocketError = 0; - /** * Protected constructor * @@ -126,7 +121,5 @@ class TcpRawDataHandler extends BaseRawDataHandler implements Networkable { $this->addRawDataToStacker($rawData); } } -} -// [EOF] -?> +} diff --git a/application/hub/classes/handler/raw_data/network/class_ b/application/hub/classes/handler/raw_data/network/class_ index 9a45b80ff..ef0cc605b 100644 --- a/application/hub/classes/handler/raw_data/network/class_ +++ b/application/hub/classes/handler/raw_data/network/class_ @@ -29,11 +29,6 @@ use Hub\Network\Networkable; * along with this program. If not, see . */ class ???RawDataHandler extends BaseRawDataHandler implements Networkable { - /** - * Last socket error (default: Success) - */ - private $lastSocketError = 0; - /** * Protected constructor * diff --git a/application/hub/classes/listener/class_BaseListener.php b/application/hub/classes/listener/class_BaseListener.php index 625f0806e..6686c6128 100644 --- a/application/hub/classes/listener/class_BaseListener.php +++ b/application/hub/classes/listener/class_BaseListener.php @@ -218,7 +218,7 @@ class BaseListener extends BaseHubSystem implements Visitable { $infoInstance->fillWithListenerInformation($this); // Register the socket - $registryInstance->registerSocket($infoInstance, $socketInstance); + $registryInstance->registerSocketInstance($infoInstance, $socketInstance); // And set it here $this->setSocketInstance($socketInstance); @@ -373,7 +373,7 @@ class BaseListener extends BaseHubSystem implements Visitable { $peerPort = '0'; // Get peer name - if (!socket_getpeername($newSocket, $peerAddress)) { + if (!socket_getpeername($newSocket, $peerAddress, $peerPort)) { // Handle this socket error with a faked recipientData array $this->handleSocketError(__METHOD__, __LINE__, $newSocket, array('0.0.0.0', '0')); } // END - if @@ -398,7 +398,7 @@ class BaseListener extends BaseHubSystem implements Visitable { $registryInstance = SocketRegistryFactory::createSocketRegistryInstance(); // Register the socket with the registry and with the faked array - $registryInstance->registerSocket($infoInstance, $newSocket, $packageData); + $registryInstance->registerSocketInstance($infoInstance, $newSocket, $packageData); } // END - if // Do we have to rewind? diff --git a/application/hub/classes/listener/socket/class_SocketFileListener.php b/application/hub/classes/listener/socket/class_SocketFileListener.php index b53d669a5..e939c9f82 100644 --- a/application/hub/classes/listener/socket/class_SocketFileListener.php +++ b/application/hub/classes/listener/socket/class_SocketFileListener.php @@ -70,7 +70,7 @@ class SocketFileListener extends BaseListener implements Listenable { // Create socket with factory $socketInstance = SocketFactory::createListenFileSocket($this); - // Set the main socket + // Set the socket instance $this->registerServerSocketInstance($socketInstance); // Initialize the peer pool instance diff --git a/application/hub/classes/package/class_NetworkPackage.php b/application/hub/classes/package/class_NetworkPackage.php index 1e35c4ada..3c26b71d1 100644 --- a/application/hub/classes/package/class_NetworkPackage.php +++ b/application/hub/classes/package/class_NetworkPackage.php @@ -639,7 +639,7 @@ class NetworkPackage extends BaseHubSystem implements Deliverable, Receivable, R //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('NETWORK-PACKAGE: Registering socket ' . $socketInstance . ' ...'); // Then register it - $registryInstance->registerSocket($infoInstance, $socketInstance, $packageData); + $registryInstance->registerSocketInstance($infoInstance, $socketInstance, $packageData); } elseif (!$helperInstance->getStateInstance()->isPeerStateConnected()) { // Is not connected, then we cannot send self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('NETWORK-PACKAGE: Unexpected peer state ' . $helperInstance->getStateInstance()->__toString() . ' detected.'); diff --git a/application/hub/classes/registry/socket/class_SocketRegistry.php b/application/hub/classes/registry/socket/class_SocketRegistry.php index 82ab76481..0b61576b1 100644 --- a/application/hub/classes/registry/socket/class_SocketRegistry.php +++ b/application/hub/classes/registry/socket/class_SocketRegistry.php @@ -214,7 +214,7 @@ class SocketRegistry extends BaseRegistry implements Register, RegisterableSocke * @throws SocketAlreadyRegisteredException If the given socket is already registered * @return void */ - public function registerSocket (ShareableInfo $infoInstance, StorableSocket $socketInstance, array $packageData = array()) { + public function registerSocketInstance (ShareableInfo $infoInstance, StorableSocket $socketInstance, array $packageData = array()) { // Debug message //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('SOCKET-REGISTRY:info=' . $infoInstance->getProtocolName() . ',socketResource[' . gettype($socketInstance->getSocketResource()) . ']=' . $socketInstance->getSocketResource() . ' - CALLED!'); diff --git a/application/hub/exceptions/socket/class_SocketShutdownException.php b/application/hub/exceptions/socket/class_SocketShutdownException.php index 0793c6ea8..a826fa2a4 100644 --- a/application/hub/exceptions/socket/class_SocketShutdownException.php +++ b/application/hub/exceptions/socket/class_SocketShutdownException.php @@ -44,7 +44,7 @@ class SocketShutdownException extends AbstractSocketException { $message = sprintf('[%s:] Socket %s cannot be shutdown down. errNo=%s, errStr=%s', $helperInstance->__toString(), $socketInstance->getSocketResource(), - $socketInstance->getLastSocketError(), + $socketInstance->getLastSocketErrorCode(), $socketInstance->getLastSocketErrorMessage() ); diff --git a/application/hub/interfaces/container/socket/class_StorableSocket.php b/application/hub/interfaces/container/socket/class_StorableSocket.php index 45945c85a..e48a80439 100644 --- a/application/hub/interfaces/container/socket/class_StorableSocket.php +++ b/application/hub/interfaces/container/socket/class_StorableSocket.php @@ -82,13 +82,6 @@ interface StorableSocket extends FrameworkInterface { */ function getSocketPeerName (&$peerAddress, &$peerPort); - /** - * Some "getter" for socket type of stored socket - * - * @return $socketType Socket type - */ - function getSocketType (); - /** * Getter for socket procotol field * @@ -145,15 +138,15 @@ interface StorableSocket extends FrameworkInterface { /** * Getter for last socket error * - * @return $lastSocketError Last socket error + * @return $errorCode Last socket error * @throws InvalidSocketException If stored socket is invalid */ - function getLastSocketError (); + function getLastSocketErrorCode (); /** * Getter for last socket error message * - * @return $lastSocketErrorMessage Last socket error message + * @return $errorMessage Last socket error message * @throws InvalidSocketException If stored socket is invalid */ function getLastSocketErrorMessage (); diff --git a/application/hub/interfaces/registry/socket/class_RegisterableSocket.php b/application/hub/interfaces/registry/socket/class_RegisterableSocket.php index 43be4ece7..d02c0dd99 100644 --- a/application/hub/interfaces/registry/socket/class_RegisterableSocket.php +++ b/application/hub/interfaces/registry/socket/class_RegisterableSocket.php @@ -3,6 +3,7 @@ namespace Hub\Registry\Socket; // Import application-specific stuff +use Hub\Container\Socket\StorableSocket; use Hub\Information\ShareableInfo; // Import framework stuff @@ -37,20 +38,20 @@ interface RegisterableSocket extends Registerable { * false only the instance will be checked. * * @param $infoInstance An instance of a ShareableInfo class - * @param $socketResource A valid socket resource + * @param $socketInstance An instance of a StorableSocket class * @return $isRegistered Whether the given socket resource is registered */ - function isSocketRegistered (ShareableInfo $infoInstance, $socketResource); + function isSocketRegistered (ShareableInfo $infoInstance, StorableSocket $socketInstance); /** * Registeres given socket for listener or throws an exception if it is already registered * * @param $infoInstance An instance of a ShareableInfo class - * @param $socketResource A valid socket resource + * @param $socketInstance An instance of a StorableSocket class * @return void * @throws SocketAlreadyRegisteredException If the given socket is already registered */ - function registerSocket (ShareableInfo $infoInstance, $socketResource); + function registerSocketInstance (ShareableInfo $infoInstance, StorableSocket $socketInstance); /** * Getter for given listener's socket resource -- 2.39.5