From 2c416f4507c23a19800dd055ec2f0e0e430c939c Mon Sep 17 00:00:00 2001 From: =?utf8?q?Roland=20H=C3=A4der?= Date: Sat, 19 May 2012 14:53:51 +0000 Subject: [PATCH] Added ifSocketResourceMatches() --- .../container/socket/class_SocketContainer.php | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/inc/classes/main/container/socket/class_SocketContainer.php b/inc/classes/main/container/socket/class_SocketContainer.php index 03cbc1cf..d7bb080e 100644 --- a/inc/classes/main/container/socket/class_SocketContainer.php +++ b/inc/classes/main/container/socket/class_SocketContainer.php @@ -83,6 +83,23 @@ class SocketContainer extends BaseContainer implements Registerable { // Return result return $matches; } + + /** + * Checks whether the given socket matches with stored + * + * @param $addressPort The address:port (IP to check + * @return $matches Whether given socket matches + */ + public final function ifSocketResourceMatches ($socketResource) { + // Debug message + /* NOISY-DEBUG: */ $this->debugOutput('SOCKET-CONTAINER: socketResource[' . gettype($socketResource) . ']=' .$socketResource . ',storedResource[' . gettype($this->getSocketResource()) . ']=' . $this->getSocketResource()); + + // So, does both match? + $matches = ((is_resource($socketResource)) && ($socketResource === $this->getSocketResource())); + + // Return result + return $matches; + } } // [EOF] -- 2.30.2