Added ifSocketResourceMatches()
[core.git] / inc / classes / main / container / socket / class_SocketContainer.php
index 03cbc1c..d7bb080 100644 (file)
@@ -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]