]> git.mxchange.org Git - hub.git/commitdiff
Continued:
authorRoland Häder <roland@mxchange.org>
Tue, 30 May 2017 15:54:53 +0000 (17:54 +0200)
committerRoland Häder <roland@mxchange.org>
Fri, 21 Aug 2020 16:50:10 +0000 (18:50 +0200)
- added much more debug lines
- UdpListener::initListener() or so, is now rewritten (much untested)
- BaseListener::ifListenerAcceptsPackageData() is now implemented and should
  always be used to check if the package's socket protocol is accepted
- imported SocketAlreadyRegisteredException
- imported ShareableInfo
- imported LogicException (and maybe others)
- need to get socket resource from socketInstance
- updated core

Signed-off-by: Roland Häder <roland@mxchange.org>
30 files changed:
application/hub/classes/class_BaseHubSystem.php
application/hub/classes/container/socket/class_SocketContainer.php
application/hub/classes/discovery/recipient/socket/class_PackageSocketDiscovery.php
application/hub/classes/factories/socket/class_SocketFactory.php
application/hub/classes/handler/raw_data/class_
application/hub/classes/handler/raw_data/class_BaseRawDataHandler.php
application/hub/classes/handler/raw_data/socket/class_SocketRawDataHandler.php
application/hub/classes/handler/raw_data/tcp/class_TcpRawDataHandler.php
application/hub/classes/handler/raw_data/udp/class_UdpRawDataHandler.php
application/hub/classes/listener/class_BaseListener.php
application/hub/classes/listener/class_BaseListenerDecorator.php
application/hub/classes/listener/socket/class_SocketFileListener.php
application/hub/classes/listener/socket/decorator/class_SocketFileListenerDecorator.php
application/hub/classes/listener/tcp/class_TcpListener.php
application/hub/classes/listener/tcp/decorators/class_ClientTcpListenerDecorator.php
application/hub/classes/listener/tcp/decorators/class_HubTcpListenerDecorator.php
application/hub/classes/listener/udp/class_UdpListener.php
application/hub/classes/listener/udp/decorators/class_ClientUdpListenerDecorator.php
application/hub/classes/listener/udp/decorators/class_HubUdpListenerDecorator.php
application/hub/classes/package/class_NetworkPackage.php
application/hub/classes/pools/class_BasePool.php
application/hub/classes/pools/peer/class_DefaultPeerPool.php
application/hub/classes/registry/socket/class_SocketRegistry.php
application/hub/classes/tasks/network/class_NetworkPackageReaderTask.php
application/hub/classes/visitor/pool/monitor/class_RawDataPoolMonitorVisitor.php
application/hub/classes/visitor/tasks/class_ActiveTaskVisitor.php
application/hub/exceptions/socket/class_NoSocketRegisteredException.php
application/hub/exceptions/socket/class_SocketShutdownException.php
application/hub/interfaces/handler/network/class_Networkable.php
core

index 10c9710ecc1bdaa9313feb0c72a2c864e1d3c164..a4d9b24c9231467d7536bf188ca0aa6cb48935cf 100644 (file)
@@ -18,7 +18,6 @@ use Hub\Pool\Poolable;
 
 // Import framework stuff
 use CoreFramework\Object\BaseFrameworkSystem;
-use CoreFramework\Socket\InvalidSocketException;
 
 /**
  * A general hub system class
index b458fd0d89a4eec4b15885b1e2467904f1156e74..688ea4cbb5cdfb28241bce1c50b592a08e269c74 100644 (file)
@@ -706,7 +706,7 @@ class SocketContainer extends BaseHubContainer implements StorableSocket, Visita
         */
        public function acceptNewIncomingSocket () {
                // Trace message
-               /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput(sprintf('%s-SOCKET: CALLED!', strtoupper($this->getSocketProtocol())));
+               /* EXTREME-NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput(sprintf('%s-SOCKET: CALLED!', strtoupper($this->getSocketProtocol())));
 
                // Should be valid socket
                if (!$this->isValidSocket()) {
@@ -714,11 +714,17 @@ class SocketContainer extends BaseHubContainer implements StorableSocket, Visita
                        throw new InvalidSocketException(array($this, $this->getSocketResource()), self::EXCEPTION_INVALID_SOCKET);
                } // END - if
 
+               // Debug message
+               /* EXTREME-NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput(sprintf('%s-SOCKET: this->socketResource=%s', strtoupper($this->getSocketProtocol()), $this->getSocketResource()));
+
                // Init all arrays, at least readers
                $readers = array($this->getSocketResource());
                $writers = array();
                $excepts = array();
 
+               // Trace message
+               /* EXTREME-NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput(sprintf('%s-SOCKET: Calling socket_select(%d,%d,%d,0%d) ...', strtoupper($this->getSocketProtocol()), count($readers), count($writers), count($excepts), $this->socketSelectTimeout));
+
                // Check if we have some peers left
                $left = socket_select(
                        $readers,
@@ -728,9 +734,12 @@ class SocketContainer extends BaseHubContainer implements StorableSocket, Visita
                        $this->socketSelectTimeout
                );
 
+               // Debug message
+               /* EXTREME-NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput(sprintf('%s-SOCKET: left=%d,readers()=%d,writers()=%d,except()=%d) ...', strtoupper($this->getSocketProtocol()), $left, count($readers), count($writers), count($excepts)));
+
                // Some new peers found?
                if ($left < 1) {
-                       // Debug message
+                       // Trace message
                        //* EXTREME-NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput(strtoupper($this->getSocketProtocol()) . '-SOCKET: left=' . $left . ',serverSocket=' . $this->getSocketResource() . ',readers=' . print_r($readers, true));
 
                        // Nothing new found
index b34090cdd93296a1778874cd2dde5fdff2fa9bb4..64655b1a8f080679270faf3c616a733eef4f1c09 100644 (file)
@@ -21,6 +21,9 @@ use CoreFramework\Registry\Registerable;
 use CoreFramework\Registry\Registry;
 use CoreFramework\Socket\InvalidSocketException;
 
+// Import SPL stuff
+use \LogicException;
+
 /**
  * A socket discovery class
  *
@@ -96,6 +99,10 @@ class PackageSocketDiscovery extends BaseRecipientDiscovery implements Discovera
                // Debug message
                /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('SOCKET-DISCOVERY: protocolName=' . $protocolName);
 
+               // Debugging
+               //* DEBUG-DIE: */ die(__METHOD__.':poolInstance='.print_r($poolInstance, TRUE));
+               //* DEBUG-DIE: */ die(__METHOD__.':poolInstance.arrayFromList('.$protocolName.')='.print_r($poolInstance->getArrayFromList($protocolName), TRUE));
+
                /*
                 * Now we need to choose again. It is whether we are speaking with a hub
                 * or with a client. So just handle it over to all listeners in this
@@ -108,10 +115,13 @@ class PackageSocketDiscovery extends BaseRecipientDiscovery implements Discovera
                        // Make sure the instance is valid
                        assert($listenerInstance instanceof Listenable);
 
+                       // Trace message
+                       /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput(sprintf('SOCKET-DISCOVERY: Calling listenerInstance->ifListenerAcceptsPackageData(%d) ...', count($packageData)));
+
                        // Does the listener want that package?
                        if ($listenerInstance->ifListenerAcceptsPackageData($packageData)) {
                                // This listener likes our package data, so abort here
-                               /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('SOCKET-DISCOVERY: Listener is accepting package data.');
+                               /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput(sprintf('SOCKET-DISCOVERY: Listener "%s" is accepting package data.', $listenerInstance->__toString()));
                                break;
                        } // END - if
 
@@ -136,6 +146,7 @@ class PackageSocketDiscovery extends BaseRecipientDiscovery implements Discovera
         * @throws      NoListGroupException    If the procol group is not found in peer list
         * @throws      NullPointerException    If listenerInstance is NULL
         * @throws      InvalidUnlException             If the provided UNL cannot be validated by the protocol handler
+        * @throws      LogicException  If the discovered listener instance has no pool set
         */
        public function discoverSocket (array $packageData, $connectionType) {
                // Debug message
@@ -170,7 +181,10 @@ class PackageSocketDiscovery extends BaseRecipientDiscovery implements Discovera
                if (is_null($listenerInstance)) {
                        // Abort with no resource
                        throw new NullPointerException($this, self::EXCEPTION_IS_NULL_POINTER);
-               } // END - if
+               } elseif (is_null($listenerInstance->getPoolInstance())) {
+                       // Opps another one
+                       throw new LogicException(sprintf('listenerInstance=%s has no poolInstance set.', $listenerInstance->__toString()), self::EXCEPTION_IS_NULL_POINTER);
+               }
 
                /*
                 * Now we have the listener instance, we can determine the right
index 5e35ab2b862e10785e819b338bbef947b603e8b4..beb2b2003f662a6f104639e5694588dce2f5244c 100644 (file)
@@ -132,7 +132,7 @@ class SocketFactory extends ObjectFactory {
                $socketInstance = self::createObjectByConfiguredName('socket_container_class', array($socketResource, StorableSocket::SOCKET_PROTOCOL_FILE, $packageData));
 
                // Debug message
-               /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput(sprintf('SOCKET-FILE_LISTENER: socketInstance[]=%s', gettype($socketInstance)));
+               /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput(sprintf('SOCKET-FACTORY: socketInstance[]=%s', gettype($socketInstance)));
 
                // Is the socket resource valid?
                if (!$socketInstance->isValidSocket()) {
@@ -256,6 +256,9 @@ class SocketFactory extends ObjectFactory {
         * @throws      InvalidSocketException  Thrown if the socket could not be initialized
         */
        public static function createListenTcpSocket (Listenable $listenerInstance) {
+               // Trace message
+               /* NOISY-DEBUG */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput(sprintf('SOCKET-FACTORY: listenerInstance=%s - CALLED!', $listenerInstance->__toString()));
+
                // Create a streaming socket, of type TCP/IP
                $socketResource = socket_create(AF_INET, SOCK_STREAM, SOL_TCP);
 
@@ -327,6 +330,9 @@ class SocketFactory extends ObjectFactory {
         * @throws      InvalidSocketException  Thrown if the socket could not be initialized
         */
        public static function createListenUdpSocket (Listenable $listenerInstance) {
+               // Trace message
+               /* NOISY-DEBUG */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput(sprintf('SOCKET-FACTORY: listenerInstance=%s - CALLED!', $listenerInstance->__toString()));
+
                // Create a streaming socket, of type TCP/IP
                $socketResource = socket_create(AF_INET, SOCK_DGRAM, SOL_UDP);
 
@@ -394,6 +400,9 @@ class SocketFactory extends ObjectFactory {
         * @throws      LogicException  If the current instance is not valid
         */
        public static final function createNextAcceptedSocketFromPool (Poolable $poolInstance, StorableSocket $socketInstance) {
+               // Trace message
+               /* NOISY-DEBUG */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput(sprintf('SOCKET-FACTORY: poolInstance=%s,socketInstance.socketResource=%s - CALLED!', $poolInstance->__toString(), $socketInstance->getSocketResource()));
+
                // Is the an iterator instance?
                if (!Registry::getRegistry()->instanceExists('pool_iterator')) {
                        // Create iterator instance
@@ -433,6 +442,9 @@ class SocketFactory extends ObjectFactory {
                // Try to accept a new (incoming) socket from current listener instance
                $acceptedSocketInstance = $current[Poolable::SOCKET_ARRAY_INSTANCE]->acceptNewIncomingSocket();
 
+               // Trace message
+               /* NOISY-DEBUG */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput(sprintf('SOCKET-FACTORY: acceptedSocketInstance[]=%s - EXIT!', gettype($acceptedSocketInstance)));
+
                // Return found socket instance
                return $acceptedSocketInstance;
        }
index 0b5036feb452d14c2990da7e77172969b28a6613..5ddd84547752f7dc1962ef276d430681622873dd 100644 (file)
@@ -56,13 +56,13 @@ class ???RawDataHandler extends BaseRawDataHandler implements Networkable {
        }
 
        /**
-        * Processes raw data from given resource. This is mostly useful for TCP
-        * package handling and is implemented in the ???Listener class
+        * Processes raw data from given socket instance. This is mostly useful for
+        * ||| package handling and is implemented in the ???Listener class.
         *
         * @param       $resource       A valid socket resource array
         * @return      void
         */
-       public function processRawDataFromResource (array $socketArray) {
+       public function processRawDataFromSocketArray (array $socketArray) {
        }
 
 }
index b05eb66e1e324bb324075a51fc6c2d9b73e3a9db..f58638c2ff6a724081ba2b81b7ec7f5c2b41ab0d 100644 (file)
@@ -90,7 +90,14 @@ class BaseRawDataHandler extends BaseHubHandler implements HubInterface {
         * @return      void
         */
        protected function initStack () {
+               // Trace message
+               /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('RAW-DATA-HANDLER: CALLED!');
+
+               // Init stack(s)
                $this->getStackInstance()->initStack(self::STACKER_NAME_RAW_DATA);
+
+               // Trace message
+               /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('RAW-DATA-HANDLER: EXIT!');
        }
 
        /**
@@ -100,6 +107,9 @@ class BaseRawDataHandler extends BaseHubHandler implements HubInterface {
         * @return      void
         */
        protected function addRawDataToStacker ($rawData) {
+               // Trace message
+               /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput(sprintf('RAW-DATA-HANDLER: rawData()=%d - CALLED!', strlen($rawData)));
+
                /*
                 * Add the deocoded data and error code to the stacker so other classes
                 * (e.g. NetworkPackage) can "pop" it from the stacker.
@@ -108,6 +118,9 @@ class BaseRawDataHandler extends BaseHubHandler implements HubInterface {
                        self::PACKAGE_RAW_DATA   => $rawData,
                        self::PACKAGE_ERROR_CODE => $this->getErrorCode()
                ));
+
+               // Trace message
+               /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('RAW-DATA-HANDLER: EXIT!');
        }
 
        /**
@@ -116,9 +129,15 @@ class BaseRawDataHandler extends BaseHubHandler implements HubInterface {
         * @return      $isPending      Whether raw data is pending
         */
        public function isRawDataPending () {
+               // Trace message
+               /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('RAW-DATA-HANDLER: CALLED!');
+
                // Does the stacker have some entries (not empty)?
                $isPending = (!$this->getStackInstance()->isStackEmpty(self::STACKER_NAME_RAW_DATA));
 
+               // Trace message
+               /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput(sprintf('RAW-DATA-HANDLER: isPending=%d - EXIT!', intval($isPending)));
+
                // Return it
                return $isPending;
        }
@@ -145,12 +164,18 @@ class BaseRawDataHandler extends BaseHubHandler implements HubInterface {
         * @todo        This method will be moved to a better place
         */
        protected function ifRecipientMatchesOwnUniversalNodeLocator (array $packageData) {
+               // Trace message
+               /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput(sprintf('RAW-DATA-HANDLER: packageData()=%d - CALLED!', strlen($packageData)));
+
                // Construct own address first
                $ownAddress = NodeObjectFactory::createNodeInstance()->determineUniversalNodeLocator();
 
                // Does it match?
                $matches = ($ownAddress === $packageData[NetworkPackage::PACKAGE_DATA_RECIPIENT]);
 
+               // Trace message
+               /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput(sprintf('RAW-DATA-HANDLER: matches=%d - EXIT!', intval($matches)));
+
                // Return result
                return $matches;
        }
index e02f2f10f6606340d12412b568c581ecc9908854..17905bfe1ef5fd64a6d7880e210c90e5d6eaab8c 100644 (file)
@@ -56,16 +56,14 @@ class SocketRawDataHandler extends BaseRawDataHandler implements Networkable {
        }
 
        /**
-        * Processes raw data from given resource. This is mostly useful for TCP
-        * package handling and is implemented in the ???Listener class
+        * Processes raw data from given socket instance. This is mostly useful for
+        * raw package handling and is implemented in the ???Listener class.
         *
         * @param       $resource       A valid socket resource array
         * @return      void
         */
-       public function processRawDataFromResource (array $socketArray) {
+       public function processRawDataFromSocketArray (array $socketArray) {
                $this->partialStub('socketArray=' . print_r($socketArray, TRUE));
        }
-}
 
-// [EOF]
-?>
+}
index a758a1e7496bdc49b56503d816a474c599036cab..b22a8d553a7eb3cc371f1b774a8f753337753e25 100644 (file)
@@ -3,10 +3,17 @@
 namespace Hub\Handler\Network\RawData\Tcp;
 
 // Import application-specific stuff
+use Hub\Container\Socket\StorableSocket;
 use Hub\Handler\Network\RawData\BaseRawDataHandler;
 use Hub\Network\Networkable;
 use Hub\Pool\Poolable;
 
+// Import framework stuff
+use CoreFramework\Socket\InvalidSocketException;
+
+// Import SPL stuff
+use \InvalidArgumentException;
+
 /**
  * A TCP raw data handler
  *
@@ -57,50 +64,56 @@ class TcpRawDataHandler extends BaseRawDataHandler implements Networkable {
        }
 
        /**
-        * Processes raw data from given resource. This is mostly useful for TCP
-        * package handling and is implemented in the TcpListener class
+        * Processes raw data from given socket instance. This is mostly useful for
+        * TCP package handling and is implemented in the TcpListener class.
         *
         * @param       $resource       A valid socket resource array
         * @return      void
+        * @throws      InvalidArgumentException        If the socket instance is not set
         */
-       public function processRawDataFromResource (array $socketArray) {
+       public function processRawDataFromSocketArray (array $socketArray) {
+               // Trace message
+               /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput(sprintf('TCP-RAWDATA-HANDLER: socketArray()=%d - CALLED!', count($socketArray)));
+
                // Check the resource
-               if ((!isset($socketArray[Poolable::SOCKET_ARRAY_INSTANCE])) || (!is_resource($socketArray[Poolable::SOCKET_ARRAY_INSTANCE]))) {
+               if ((!isset($socketArray[Poolable::SOCKET_ARRAY_INSTANCE])) || (!($socketArray[Poolable::SOCKET_ARRAY_INSTANCE] instanceof StorableSocket))) {
                        // Throw an exception
-                       throw new InvalidResourceException($this, self::EXCEPTION_INVALID_RESOURCE);
+                       throw new InvalidArgumentException(sprintf('socketArray[%s] is not set or invalid.', Poolable::SOCKET_ARRAY_INSTANCE));
                } // END - if
 
                // Reset error code to unhandled
                $this->setErrorCode(self::SOCKET_ERROR_UNHANDLED);
 
                // Debug message
-               /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('TCP-HANDLER: Handling TCP package from resource=' . $socketArray[Poolable::SOCKET_ARRAY_INSTANCE] . ',type=' . $socketArray[Poolable::SOCKET_ARRAY_CONN_TYPE] . ',last error=' . socket_strerror($this->lastSocketError));
+               /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('TCP-RAWDATA-HANDLER: Handling TCP package from resource=' . $socketArray[Poolable::SOCKET_ARRAY_INSTANCE] . ',type=' . $socketArray[Poolable::SOCKET_ARRAY_CONN_TYPE] . ',last error=' . socket_strerror($this->lastSocketError));
+               $this->partialStub('Please rewrite this part.');
+               return;
 
                /*
                 * Read the raw data from socket. If you change PHP_BINARY_READ to
                 * PHP_NORMAL_READ, this line will endless block. This script does only
-                * provide simultanous threads, not real.
+                * provide simultanous or faked threads, not real.
                 */
                $rawData = socket_read($socketArray[Poolable::SOCKET_ARRAY_INSTANCE], $this->getConfigInstance()->getConfigEntry('tcp_buffer_length'), PHP_BINARY_READ);
 
                // Get socket error code back
-               $this->lastSocketError = socket_last_error($socketArray[Poolable::SOCKET_ARRAY_INSTANCE]);
+               $this->lastSocketError = $socketArray[Poolable::SOCKET_ARRAY_INSTANCE]->getSocketLastErrorCode();
 
                // Debug output of read data length
-               /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('TCP-HANDLER: rawData[' . gettype($rawData) . ']=' . strlen($rawData) . ',MD5=' . md5($rawData) . ',resource=' . $socketArray[Poolable::SOCKET_ARRAY_INSTANCE] . ',error=' . socket_strerror($this->lastSocketError));
-               /* NOISY-DEBUG: */ if ($rawData !== FALSE) self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('TCP-HANDLER: rawData=' . $rawData);
+               /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('TCP-RAWDATA-HANDLER: rawData[' . gettype($rawData) . ']=' . strlen($rawData) . ',MD5=' . md5($rawData) . ',resource=' . $socketArray[Poolable::SOCKET_ARRAY_INSTANCE] . ',this->lastSocketError=' . socket_strerror($this->lastSocketError));
+               /* NOISY-DEBUG: */ if ($rawData !== FALSE) self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('TCP-RAWDATA-HANDLER: rawData=' . $rawData);
 
                // Is it valid?
                if ($this->lastSocketError == 11) {
                        // Debug message
-                       /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('TCP-HANDLER: Ignoring error 11 (Resource temporary unavailable) from socket resource=' . $socketArray[Poolable::SOCKET_ARRAY_INSTANCE]);
+                       /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('TCP-RAWDATA-HANDLER: Ignoring error 11 (Resource temporary unavailable) from socket resource=' . $socketArray[Poolable::SOCKET_ARRAY_INSTANCE]);
 
                        /*
                         * Error code 11 (Resource temporary unavailable) can be safely
                         * ignored on non-blocking sockets. The socket is currently not
                         * sending any data.
                         */
-                        socket_clear_error($socketArray[Poolable::SOCKET_ARRAY_INSTANCE]);
+                        $socketArray[Poolable::SOCKET_ARRAY_INSTANCE]->clearLastSocketError();
 
                         // Skip any further processing
                         return;
@@ -108,6 +121,9 @@ class TcpRawDataHandler extends BaseRawDataHandler implements Networkable {
                        // Network error or connection lost
                        $this->setErrorCode($this->lastSocketError);
                } elseif (empty($rawData)) {
+                       // Trace message
+                       /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('TCP-RAWDATA-HANDLER: No raw data pending. - EXIT!');
+
                        // The peer did send nothing to us which is now being ignored
                        return;
                } else {
@@ -117,9 +133,13 @@ class TcpRawDataHandler extends BaseRawDataHandler implements Networkable {
                         * well-formed BASE64-encoded message with start and markers. This
                         * will be checked later on.
                         */
-                       /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('TCP-HANDLER: Adding ' . strlen($rawData) . ' bytes to stacker ...');
+                       /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('TCP-RAWDATA-HANDLER: Adding ' . strlen($rawData) . ' bytes to stacker ...');
                        $this->addRawDataToStacker($rawData);
                }
+
+               // Trace message
+               /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('TCP-RAWDATA-HANDLER: EXIT!');
+
        }
 
 }
index f1aaa667fb108b7c6abb6a27c55ea8211137790c..a8e193b07139ae5c05d9d2c0ab051f51e240f7c2 100644 (file)
@@ -57,25 +57,30 @@ class UdpRawDataHandler extends BaseRawDataHandler implements Networkable {
        }
 
        /**
-        * Processes raw data from given resource. This is mostly useful for UDP
-        * package handling and is implemented in the UdpListener class
+        * Processes raw data from given socket instance. This is mostly useful for
+        * UDP package handling and is implemented in the UDPListener class
         *
-        * @param       $socketArray    A valid socket resource array
+        * @param       $resource       A valid socket resource array
         * @return      void
-        * @throws      InvalidResourceException        If the given resource is invalid
-        * @todo        0%
+        * @throws      InvalidArgumentException        If the socket instance is not set
         */
-       public function processRawDataFromResource (array $socketArray) {
+       public function processRawDataFromSocketArray (array $socketArray) {
+               // Debug message
+               /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput(sprintf('UDP-HANDLER: socketArray()=%d - CALLED!', count($socketArray)));
+
                // Check the resource
-               if ((!isset($socketArray[Poolable::SOCKET_ARRAY_INSTANCE])) || (!is_resource($socketArray[Poolable::SOCKET_ARRAY_INSTANCE]))) {
+               if ((!isset($socketArray[Poolable::SOCKET_ARRAY_INSTANCE])) || (!($socketArray[Poolable::SOCKET_ARRAY_INSTANCE] instanceof StorableSocket))) {
                        // Throw an exception
-                       throw new InvalidResourceException($this, self::EXCEPTION_INVALID_RESOURCE);
+                       throw new InvalidArgumentException(sprintf('socketArray[%s] is not set or invalid.', Poolable::SOCKET_ARRAY_INSTANCE));
                } // END - if
 
-               // Implement processing here
-               $this->partialStub('Please implement this method. resource=' . $socketArray[Poolable::SOCKET_ARRAY_INSTANCE] . ',type=' . $socketArray[Poolable::SOCKET_ARRRAY_CONN_TYPE]);
+               // Reset error code to unhandled
+               $this->setErrorCode(self::SOCKET_ERROR_UNHANDLED);
+
+               // Debug message
+               /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('UDP-HANDLER: Handling UDP package from resource=' . $socketArray[Poolable::SOCKET_ARRAY_INSTANCE] . ',type=' . $socketArray[Poolable::SOCKET_ARRAY_CONN_TYPE] . ',last error=' . socket_strerror($this->lastSocketError));
+               $this->partialStub('Please rewrite this part.');
+               return;
        }
-}
 
-// [EOF]
-?>
+}
index 90fe089b31f603d336f6b83c12f4d5129ebebb06..a557a59cc64a3ec02105345a7bb9b73d283da7ba 100644 (file)
@@ -5,9 +5,11 @@ namespace Hub\Listener;
 // Import application-specific stuff
 use Hub\Container\Socket\StorableSocket;
 use Hub\Factory\Information\Connection\ConnectionInfoFactory;
+use Hub\Factory\Network\Locator\UniversalNodeLocatorFactory;
 use Hub\Factory\Node\NodeObjectFactory;
 use Hub\Factory\Socket\SocketFactory;
 use Hub\Generic\BaseHubSystem;
+use Hub\Information\ShareableInfo;
 use Hub\Network\Package\NetworkPackage;
 use Hub\Pool\Peer\PoolablePeer;
 use Hub\Pool\Poolable;
@@ -17,9 +19,13 @@ use CoreFramework\Factory\ObjectFactory;
 use CoreFramework\Factory\Registry\Socket\SocketRegistryFactory;
 use CoreFramework\Generic\UnsupportedOperationException;
 use CoreFramework\Socket\InvalidServerSocketException;
+use CoreFramework\Socket\SocketAlreadyRegisteredException;
 use CoreFramework\Visitor\Visitable;
 use CoreFramework\Visitor\Visitor;
 
+// Import SPL stuff
+use \LogicException;
+
 /**
  * A general listener class
  *
@@ -166,10 +172,13 @@ class BaseListener extends BaseHubSystem implements Visitable {
         * @throws      SocketAlreadyRegisteredException        If the given resource is already registered
         */
        protected function registerServerSocketInstance (StorableSocket $socketInstance) {
+               // Trace message
+               /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput(sprintf('LISTENER: socketInstance=%s - CALLED!', $socketInstance->__toString()));
+
                // First check if it is valid
                if ($this->isServerSocketRegistered($socketInstance)) {
                        // Already registered
-                       throw new SocketAlreadyRegisteredException($this, self::EXCEPTION_SOCKET_ALREADY_REGISTERED);
+                       throw new SocketAlreadyRegisteredException(array($this, $socketInstance->getSocketResource()), self::EXCEPTION_SOCKET_ALREADY_REGISTERED);
                } // END - if
 
                // Get a socket registry instance (singleton)
@@ -184,8 +193,14 @@ class BaseListener extends BaseHubSystem implements Visitable {
                // Register the socket
                $registryInstance->registerSocketInstance($infoInstance, $socketInstance);
 
+               // Debug message
+               /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput(sprintf('LISTENER: Setting socketInstance ... (socketResource=%s)', $socketInstance->getSocketResource()));
+
                // And set it here
                $this->setSocketInstance($socketInstance);
+
+               // Trace message
+               /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('LISTENER: EXIT!');
        }
 
        /**
@@ -193,20 +208,39 @@ class BaseListener extends BaseHubSystem implements Visitable {
         *
         * @param       $socketInstance         An instance of a StorableSocket class
         * @return      $isRegistered           Whether given server socket is registered
+        * @throws      LogicException  If no info instance can be created
         */
        protected function isServerSocketRegistered (StorableSocket $socketInstance) {
+               // Trace message
+               /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput(sprintf('LISTENER: socketInstance=%s - CALLED!', $socketInstance->__toString()));
+
                // Get a socket registry instance (singleton)
                $registryInstance = SocketRegistryFactory::createSocketRegistryInstance();
 
                // Get a connection info instance
                $infoInstance = ConnectionInfoFactory::createConnectionInfoInstance($this->getProtocolName(), 'listener');
 
+               // Debug message
+               /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput(sprintf('LISTENER: infoInstance[]=%s', gettype($infoInstance)));
+
+               // Is the instance set?
+               if (!($infoInstance instanceof ShareableInfo)) {
+                       // Should not happen
+                       throw new LogicException(sprintf('infoInstance[]=%s does not implement ShareableInfo', gettype($infoInstance)));
+               } // END - if
+
                // Will the info instance with listener data
                $infoInstance->fillWithListenerInformation($this);
 
+               // Debug message
+               /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput(sprintf('LISTENER: Checking socketInstance ... (socketResource=%s)', $socketInstance->getSocketResource()));
+
                // Check it
                $isRegistered = $registryInstance->isSocketRegistered($infoInstance, $socketInstance);
 
+               // Trace message
+               /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput(sprintf('LISTENER: isRegistered=%d - EXIT!', intval($isRegistered)));
+
                // Return result
                return $isRegistered;
        }
@@ -252,6 +286,9 @@ class BaseListener extends BaseHubSystem implements Visitable {
         * @return      void
         */
        protected function doListenSocketSelect ($peerSuffix) {
+               // Trace message
+               /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput(sprintf('LISTENER: peerSuffix=%s - CALLED!', $peerSuffix));
+
                // Check on all instances
                assert($this->getPoolInstance() instanceof Poolable);
                assert($this->getSocketInstance()->isValidSocket());
@@ -259,12 +296,21 @@ class BaseListener extends BaseHubSystem implements Visitable {
                // Get next socket instance from pool over the factory
                $socketInstance = SocketFactory::createNextAcceptedSocketFromPool($this->getPoolInstance(), $this->getSocketInstance());
 
+               // Debug message
+               /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput(sprintf('LISTENER: socketInstance[]=%s accepted.', gettype($socketInstance)));
+
                // Is socket instance set?
                if (!($socketInstance instanceof StorableSocket)) {
+                       // Trace message
+                       /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('LISTENER: No new connection on listener ... - EXIT!');
+
                        // Nothing has changed on the listener
                        return;
                } // END - if
 
+               // Debug message
+               /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput(sprintf('LISTENER: socketInstance.socketResource=%s accepted.', $socketInstance->getSocketResource()));
+
                // Init peer address/port
                $peerAddress = '0.0.0.0';
                $peerPort    = '0';
@@ -306,15 +352,52 @@ class BaseListener extends BaseHubSystem implements Visitable {
                // Get the current value
                $currentSocketData = $this->getIteratorInstance()->current();
 
+               // Debug message
+               /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('LISTENER: currentSocketData=' . $currentSocketData[Poolable::SOCKET_ARRAY_INSTANCE] . ',type=' . $currentSocketData[Poolable::SOCKET_ARRAY_CONN_TYPE] . ',serverSocket=' . $this->getSocketInstance()->getSocketResource());
+
                // Handle it here, if not main server socket
-               /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('TCP-LISTENER: currentSocketData=' . $currentSocketData[Poolable::SOCKET_ARRAY_INSTANCE] . ',type=' . $currentSocketData[Poolable::SOCKET_ARRAY_CONN_TYPE] . ',serverSocket=' . $this->getSocketInstance()->getSocketResource());
                if (($currentSocketData[Poolable::SOCKET_ARRAY_CONN_TYPE] != StorableSocket::CONNECTION_TYPE_SERVER) && (!$currentSocketData[Poolable::SOCKET_ARRAY_INSTANCE]->equals($this->getSocketInstance()))) {
                        // ... or else it will raise warnings like 'Transport endpoint is not connected'
-                       $this->getHandlerInstance()->processRawDataFromResource($currentSocketData);
+                       $this->getHandlerInstance()->processRawDataFromSocketArray($currentSocketData);
                } // END - if
 
                // Advance to next entry. This should be the last line.
                $this->getIteratorInstance()->next();
+
+               // Trace message
+               /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('LISTENER: EXIT!');
+       }
+
+       /**
+        * Checks whether the listener would accept the given package data array
+        *
+        * @param       $packageData    Raw package data
+        * @return      $accepts                Whether this listener does accept
+        */
+       public function ifListenerAcceptsPackageData (array $packageData) {
+               // Trace message
+               /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput(sprintf('LISTENER: packageData()=%d - CALLED!', count($packageData)));
+
+               // Check if same socket protocol
+               $socketProtocol = $this->getSocketInstance()->getSocketProtocol();
+
+               // Get UNL instance
+               $unlInstance = UniversalNodeLocatorFactory::createUnlInstanceFromString($packageData[NetworkPackage::PACKAGE_DATA_RECIPIENT]);
+
+               // Get protocol from it
+               $unlProtocol = $unlInstance->getUnlProtocol();
+
+               // Debug message
+               /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput(sprintf('LISTENER: unlInstance.unlProtocol=%s,socketProtocol=%s', $unlProtocol, $socketProtocol));
+
+               // Is same protocol?
+               $accepts = ($unlProtocol == $socketProtocol);
+
+               // Trace message
+               /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput(sprintf('LISTENER: accepts=%d - EXIT!', $accepts));
+
+               // Return the result
+               return $accepts;
        }
 
 }
index 63c6ec3c8331ceb89d546b69dfb5865e42fe5dd3..620a4eec45a88eb50ee50c52cebca505d7f32407 100644 (file)
@@ -125,6 +125,10 @@ class BaseListenerDecorator extends BaseDecorator implements Visitable {
         * @return      $poolInstance   A peer pool instance
         */
        public final function getPoolInstance () {
+               // Trace message
+               /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput(sprintf('LISTENER-DECORATOR: Getting poolInstance from inner listenerInstance=%s - CALLED!', $this->getListenerInstance()->__toString()));
+
+               // Get it
                return $this->getListenerInstance()->getPoolInstance();
        }
 
@@ -152,6 +156,9 @@ class BaseListenerDecorator extends BaseDecorator implements Visitable {
                        return;
                } // END - if
 
+               // Debug message
+               /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput(sprintf('LISTENER-DECORATOR: handlerInstance=%s', $handlerInstance->__toString()));
+
                // Does the handler have some decoded data pending?
                if (!$handlerInstance->isRawDataPending()) {
                        // No data is pending so skip further code silently
index 002b09486e6718be4975edcd4394518f2df3de58..d35a4bc005ad1631a8a3d4abc5d3558b9d5b0d18 100644 (file)
@@ -5,6 +5,7 @@ namespace Hub\Listener\Socket;
 // Import application-specific stuff
 use Hub\Container\Socket\StorableSocket;
 use Hub\Factory\Socket\SocketFactory;
+use Hub\Factory\Tag\Package\PackageTagsFactory;
 use Hub\Listener\BaseListener;
 use Hub\Listener\Listenable;
 
@@ -105,8 +106,14 @@ class SocketFileListener extends BaseListener implements Listenable {
         * @return      void
         */
        public function doListen() {
+               // Trace message
+               /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('SOCKET-FILE-LISTENER: Calling this->doListenSocketSelect() ... - CALLED!');
+
                // Call super method
                $this->doListenSocketSelect('');
+
+               // Trace message
+               /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('SOCKET-FILE-LISTENER: EXIT!');
        }
 
        /**
@@ -116,7 +123,32 @@ class SocketFileListener extends BaseListener implements Listenable {
         * @return      $accepts                Whether this listener does accept
         */
        public function ifListenerAcceptsPackageData (array $packageData) {
-               $this->partialStub('Need to implement this method.');
+               // Trace message
+               /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput(sprintf('SOCKET-FILE-LISTENER: packageData()=%d - CALLED!', count($packageData)));
+
+               // Call parent method
+               if (!parent::ifListenerAcceptsPackageData($packageData)) {
+                       // Trace message
+                       /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('SOCKET-FILE-LISTENER: Protocol mismatching, not accepting package.');
+
+                       // Is already different protocol
+                       return FALSE;
+               } // END - if
+
+               // Debugging
+               /* DEBUG-DIE: */ die(__METHOD__.':packageData='.print_r($packageData, TRUE));
+
+               // Get a tags instance
+               $tagsInstance = PackageTagsFactory::createPackageTagsInstance();
+
+               // So is the package accepted with this listener?
+               $accepts = $tagsInstance->ifPackageDataIsAcceptedByListener($packageData, $this);
+
+               // Trace message
+               /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput(sprintf('SOCKET-FILE-LISTENER: accepts=%d - EXIT!', $accepts));
+
+               // Return the result
+               return $accepts;
        }
 
        /**
index afbb779a5555dfb73ea744e868e0ff1e56136fad..cd1af3927e2d8d7a4acd9a1efed5a3fc5f444a25 100644 (file)
@@ -96,14 +96,8 @@ class SocketFileListenerDecorator extends BaseListenerDecorator implements Liste
         * @return      $accepts                Whether this listener does accept
         */
        public function ifListenerAcceptsPackageData (array $packageData) {
-               // Get a tags instance
-               $tagsInstance = PackageTagsFactory::createPackageTagsInstance();
-
-               // So is the package accepted with this listener?
-               $accepts = $tagsInstance->ifPackageDataIsAcceptedByListener($packageData, $this);
-
-               // Return the result
-               return $accepts;
+               // Call inner method, no decoration is wanted in this method
+               return $this->getListenerInstance()->ifListenerAcceptsPackageData($packageData);
        }
 
 }
index 04497715fc0d95369d0113b74aa07059f55fe087..afe84f4d6a37dc219392c0ae1f66eb620fc36f1b 100644 (file)
@@ -105,8 +105,14 @@ class TcpListener extends BaseListener implements Listenable {
         * @return      void
         */
        public function doListen () {
+               // Trace message
+               /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('TCP-LISTENER: Calling this->doListenSocketSelect(:0) ... - CALLED!');
+
                // Call super method
                $this->doListenSocketSelect(':0');
+
+               // Trace message
+               /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('TCP-LISTENER: EXIT!');
        }
 
        /**
index 7f387d6ee920ba6b15758dbf27dd5f87d7ecde33..672c1384b6ae7c054fb23657b95777f61396909a 100644 (file)
@@ -96,16 +96,32 @@ class ClientTcpListenerDecorator extends BaseListenerDecorator implements Listen
         * @return      $accepts                Whether this listener does accept
         */
        public function ifListenerAcceptsPackageData (array $packageData) {
+               // Trace message
+               /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput(sprintf('CLIENT-TCP-LISTENER: packageData()=%d - CALLED!', count($packageData)));
+
+               // Call parent method
+               if (!parent::ifListenerAcceptsPackageData($packageData)) {
+                       // Trace message
+                       /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('SOCKET-FILE-LISTENER: Protocol mismatching, not accepting package.');
+
+                       // Is already different protocol
+                       return FALSE;
+               } // END - if
+
+               // Debugging
+               /* DEBUG-DIE: */ die(__METHOD__.':packageData='.print_r($packageData, TRUE));
+
                // Get a tags instance
                $tagsInstance = PackageTagsFactory::createPackageTagsInstance();
 
                // So is the package accepted with this listener?
                $accepts = $tagsInstance->ifPackageDataIsAcceptedByListener($packageData, $this);
 
+               // Trace message
+               /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput(sprintf('CLIENT-TCP-LISTENER: accepts=%d - EXIT!', $accepts));
+
                // Return the result
                return $accepts;
        }
-}
 
-// [EOF]
-?>
+}
index e25230176c9dc9c6781a6b60d3dde9001d7f94fd..b4e252b19ce44131c4ac0d24a3a4a67cadb386e1 100644 (file)
@@ -96,16 +96,32 @@ class HubTcpListenerDecorator extends BaseListenerDecorator implements Listenabl
         * @return      $accepts                Whether this listener does accept
         */
        public function ifListenerAcceptsPackageData (array $packageData) {
+               // Trace message
+               /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput(sprintf('HUB-TCP-LISTENER: packageData()=%d - CALLED!', count($packageData)));
+
+               // Call parent method
+               if (!parent::ifListenerAcceptsPackageData($packageData)) {
+                       // Trace message
+                       /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('SOCKET-FILE-LISTENER: Protocol mismatching, not accepting package.');
+
+                       // Is already different protocol
+                       return FALSE;
+               } // END - if
+
+               // Debugging
+               /* DEBUG-DIE: */ die(__METHOD__.':packageData='.print_r($packageData, TRUE));
+
                // Get a tags instance
                $tagsInstance = PackageTagsFactory::createPackageTagsInstance();
 
                // So is the package accepted with this listener?
                $accepts = $tagsInstance->ifPackageDataIsAcceptedByListener($packageData, $this);
 
+               // Trace message
+               /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput(sprintf('HUB-TCP-LISTENER: accepts=%d - EXIT!', $accepts));
+
                // Return the result
                return $accepts;
        }
-}
 
-// [EOF]
-?>
+}
index 5c9dc4aaa26ad4753bb91121416498a7b8ba7704..60a94ecaccd4b73d36848e0c6a2636c68e363579 100644 (file)
@@ -10,6 +10,7 @@ use Hub\Listener\Listenable;
 
 // Import framework stuff
 use CoreFramework\Factory\ObjectFactory;
+use CoreFramework\Generic\UnsupportedOperationException;
 
 /**
  * An UDP connection listener
@@ -66,12 +67,28 @@ class UdpListener extends BaseListener implements Listenable {
         * @return      void
         */
        public function initListener () {
-               // Get socket instance
+               // Get instance from socket factory
                $socketInstance = SocketFactory::createListenUdpSocket($this);
 
-               // Remember the socket in our class
+               // Set socket instance
                $this->registerServerSocketInstance($socketInstance);
 
+               // Initialize the peer pool instance
+               $poolInstance = ObjectFactory::createObjectByConfiguredName('node_pool_class', array($this));
+
+               // Add main socket
+               $poolInstance->addPeer($socketInstance, StorableSocket::CONNECTION_TYPE_SERVER);
+
+               // And add it to this listener
+               $this->setPoolInstance($poolInstance);
+
+               // Initialize iterator for listening on packages
+               $iteratorInstance = $poolInstance->createListIteratorInstance('network_listen');
+
+               // Rewind it and remember it in this class
+               $iteratorInstance->rewind();
+               $this->setIteratorInstance($iteratorInstance);
+
                // Initialize the network package handler
                $handlerInstance = ObjectFactory::createObjectByConfiguredName('udp_raw_data_handler_class');
 
@@ -86,43 +103,16 @@ class UdpListener extends BaseListener implements Listenable {
         * "Listens" for incoming network packages
         *
         * @return      void
-        * @todo        ~50% done
         */
-       public function doListen() {
-               $this->partialStub('Please rewrite this part.');
-               return;
-
-               // Read a package and determine the peer
-               $amount = @socket_recvfrom($this->getSocketInstance(), $rawData, $this->getConfigInstance()->getConfigEntry('udp_buffer_length'), MSG_DONTWAIT, $peer, $port);
-
-               // Get last error
-               $lastError = $this->getSocketInstance()->getSocketLastErrorCode();
-
-               // Do we have an error at the line?
-               if ($lastError == 11) {
-                       /*
-                        * This (resource temporary unavailable) can be safely ignored on
-                        * "listening" UDP ports. If we don't clear the error here, our UDP
-                        * "listener" won't read any packages except if the UDP sender
-                        * starts the transmission before this "listener" came up...
-                        */
-                       $this->getSocketInstance()->clearLastSocketError();
-
-                       // Skip further processing
-                       return;
-               } elseif ($lastError > 0) {
-                       // Other error detected
-                       self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('UDP-LISTENER: Error detected: ' . socket_strerror($lastError));
-
-                       // Skip further processing
-                       return;
-               } elseif ((empty($rawData)) || (trim($peer) == '')) {
-                       // Zero sized packages/peer names are usual in non-blocking mode
-                       return;
-               } // END - if
-
-               // Debug only
-               self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('UDP-LISTENER: Handling UDP package with size ' . strlen($rawData) . ' from peer ' . $peer . ':' . $port);
+       public function doListen () {
+               // Trace message
+               /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('UDP-LISTENER: Calling this->doListenSocketSelect(:0) ... - CALLED!');
+
+               // Call super method
+               $this->doListenSocketSelect(':0');
+
+               // Trace message
+               /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('UDP-LISTENER: EXIT!');
        }
 
        /**
@@ -130,11 +120,10 @@ class UdpListener extends BaseListener implements Listenable {
         *
         * @param       $packageData    Raw package data
         * @return      $accepts                Whether this listener does accept
+        * @throws      UnsupportedOperationException   If this method is called
         */
-       function ifListenerAcceptsPackageData (array $packageData) {
-               $this->partialStub('This call should not happen. Please report it.');
+       public function ifListenerAcceptsPackageData (array $packageData) {
+               throw new UnsupportedOperationException(array($this, __FUNCTION__), self::EXCEPTION_UNSPPORTED_OPERATION);
        }
-}
 
-// [EOF]
-?>
+}
index 2737c57a8b0fbf0fa039fd10d204420f24ae8527..07804f42bd037bfaa0d604ae959a818d3d694dc8 100644 (file)
@@ -96,16 +96,32 @@ class ClientUdpListenerDecorator extends BaseListenerDecorator implements Listen
         * @return      $accepts                Whether this listener does accept
         */
        function ifListenerAcceptsPackageData (array $packageData) {
+               // Trace message
+               /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput(sprintf('CLIENT-UDP-LISTENER: packageData()=%d - CALLED!', count($packageData)));
+
+               // Call parent method
+               if (!parent::ifListenerAcceptsPackageData($packageData)) {
+                       // Trace message
+                       /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('SOCKET-FILE-LISTENER: Protocol mismatching, not accepting package.');
+
+                       // Is already different protocol
+                       return FALSE;
+               } // END - if
+
+               // Debugging
+               /* DEBUG-DIE: */ die(__METHOD__.':packageData='.print_r($packageData, TRUE));
+
                // Get a tags instance
                $tagsInstance = PackageTagsFactory::createPackageTagsInstance();
 
                // So is the package accepted with this listener?
                $accepts = $tagsInstance->ifPackageDataIsAcceptedByListener($packageData, $this);
 
+               // Trace message
+               /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput(sprintf('CLIENT-UDP-LISTENER: accepts=%d - EXIT!', $accepts));
+
                // Return the result
                return $accepts;
        }
-}
 
-// [EOF]
-?>
+}
index eaaa9d0e2cced481f36cc6eac9798c1546cdfad1..1c3389fe0a9aa1cbdc8748fa5b60de5bdb6d9881 100644 (file)
@@ -96,16 +96,32 @@ class HubUdpListenerDecorator extends BaseListenerDecorator implements Listenabl
         * @return      $accepts                Whether this listener does accept
         */
        public function ifListenerAcceptsPackageData (array $packageData) {
+               // Trace message
+               /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput(sprintf('HUB-UDP-LISTENER: packageData()=%d - CALLED!', count($packageData)));
+
+               // Call parent method
+               if (!parent::ifListenerAcceptsPackageData($packageData)) {
+                       // Trace message
+                       /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('SOCKET-FILE-LISTENER: Protocol mismatching, not accepting package.');
+
+                       // Is already different protocol
+                       return FALSE;
+               } // END - if
+
+               // Debugging
+               /* DEBUG-DIE: */ die(__METHOD__.':packageData='.print_r($packageData, TRUE));
+
                // Get a tags instance
                $tagsInstance = PackageTagsFactory::createPackageTagsInstance();
 
                // So is the package accepted with this listener?
                $accepts = $tagsInstance->ifPackageDataIsAcceptedByListener($packageData, $this);
 
+               // Trace message
+               /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput(sprintf('HUB-UDP-LISTENER: accepts=%d - EXIT!', $accepts));
+
                // Return the result
                return $accepts;
        }
-}
 
-// [EOF]
-?>
+}
index 80ef7471503dd4f4c31f8b39fb4840a0cd1fd807..2ffd307713d56e2b54968084b53d22fae074a619 100644 (file)
@@ -1077,6 +1077,9 @@ class NetworkPackage extends BaseHubSystem implements Deliverable, Receivable, R
         * @return      $isPending      Whether decoded raw data is pending
         */
        private function isRawDataPending () {
+               // Trace message
+               /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('NETWORK-PACKAGE: CALLED!');
+
                // Just return whether the stack is not empty
                $isPending = (!$this->getStackInstance()->isStackEmpty(self::STACKER_NAME_DECODED_INCOMING));
 
@@ -1090,12 +1093,18 @@ class NetworkPackage extends BaseHubSystem implements Deliverable, Receivable, R
         * @return      $hasArrived             Whether new raw package data has arrived for processing
         */
        public function isNewRawDataPending () {
+               // Trace message
+               /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput(sprintf('NETWORK-PACKAGE: Calling this->getListenerPoolInstance()->accept(%s) ... - CALLED!', $this->getVisitorInstance()));
+
                // Visit the pool. This monitors the pool for incoming raw data.
                $this->getListenerPoolInstance()->accept($this->getVisitorInstance());
 
                // Check for new data arrival
                $hasArrived = $this->isRawDataPending();
 
+               // Trace message
+               /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput(sprintf('NETWORK-PACKAGE: hasArrived=%d - EXIT!', intval($hasArrived)));
+
                // Return the status
                return $hasArrived;
        }
index 935a0e62d164dc8c6bedc2debf6c46d403b845f2..ab2ba2ed4b06fc5bba90012910daeb62a8b9278c 100644 (file)
@@ -52,6 +52,9 @@ abstract class BasePool extends BaseHubSystem implements Poolable, Visitable {
 
                // Init the pool entries
                $this->poolEntriesInstance = ObjectFactory::createObjectByConfiguredName('pool_entries_list_class');
+
+               // Register this instance as call-back
+               $this->getPoolEntriesInstance()->setCallbackInstance($this);
        }
 
        /**
@@ -199,4 +202,36 @@ abstract class BasePool extends BaseHubSystem implements Poolable, Visitable {
                return $iteratorInstance;
        }
 
+       /**
+        * Creates a hash based on given entry
+        *
+        * @param       $entry  Array entry to be used
+        * @return      $hash   Hash from it
+        */
+       public function generateListHashFromEntry (array $entry) {
+               // Trace message
+               /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput(sprintf('POOL: entry()=%d - CALLED!', count($entry)));
+
+               // Debugging:
+               //* DEBUG-DIE: */ die(__METHOD__.':entry='.print_r($entry, TRUE));
+
+               // Init variable
+               $hash = NULL;
+
+               // Is 'instance' and 'connection_type' set?
+               if ((isset($entry[Poolable::SOCKET_ARRAY_INSTANCE])) && (isset($entry[Poolable::SOCKET_ARRAY_CONN_TYPE]))) {
+                       // Get socket resource and type
+                       $hash = $entry[Poolable::SOCKET_ARRAY_INSTANCE]->getSocketResource() . ':' . $entry[Poolable::SOCKET_ARRAY_CONN_TYPE];
+               } else {
+                       // Not supported
+                       $this->debugInstance(sprintf('[%s:%d]: entry=%s is not supported.', __METHOD__, __LINE__, print_r($entry, TRUE)));
+               }
+
+               // Trace message
+               /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput(sprintf('POOL: hash[%s]=%s - EXIT!', gettype($hash), $hash));
+
+               // Return hash
+               return $hash;
+       }
+
 }
index 0ab4cee090d1186e1d3f4f89f6d41ecf378eaf8f..a843c7c9d1d6ded435cd7be978cde8f420cb31e1 100644 (file)
@@ -133,11 +133,11 @@ class DefaultPeerPool extends BasePool implements PoolablePeer {
                        } // END - if
                } else {
                        // Server sockets won't work with socket_getpeername()
-                       self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('POOL: Socket resource is server socket (' . $socketInstance->getSocketResource() . '). This is not a bug.');
+                       self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('DEFAULT-PEER-POOL: Socket resource is server socket (' . $socketInstance->getSocketResource() . '). This is not a bug.');
                }
 
                // Debug message
-               self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('POOL: Adding peer ' . $peerAddress . ':' . $peerPort . ',socketResource=' . $socketInstance->getSocketResource() . ',connectionType=' . $connectionType);
+               self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('DEFAULT-PEER-POOL: Adding peer ' . $peerAddress . ':' . $peerPort . ',socketResource=' . $socketInstance->getSocketResource() . ',connectionType=' . $connectionType);
 
                // Construct the array
                $socketArray = array(
@@ -228,7 +228,7 @@ class DefaultPeerPool extends BasePool implements PoolablePeer {
         */
        public function getSocketFromPackageData (array $packageData, $connectionType = NULL) {
                // Trace message
-               /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput(sprintf('POOL:packageData()=%d,connectionType[%s]=%s - CALLED!', count($packageData), gettype($connectionType), $connectionType));
+               /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput(sprintf('DEFAULT-PEER-POOL:packageData()=%d,connectionType[%s]=%s - CALLED!', count($packageData), gettype($connectionType), $connectionType));
 
                // Default is no socket
                $socketInstance = NULL;
@@ -240,7 +240,7 @@ class DefaultPeerPool extends BasePool implements PoolablePeer {
                $unlInstance = $handlerInstance->getUniversalNodeLocatorInstance();
 
                // Debug message
-               /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('POOL: Checking ' . count($this->getAllSockets()) . ' socket(s),unlInstance.unl=' . $unlInstance->generateUnl() . ' ...');
+               /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('DEFAULT-PEER-POOL: Checking ' . count($this->getAllSockets()) . ' socket(s),unlInstance.unl=' . $unlInstance->generateUnl() . ' ...');
 
                // Default is all sockets
                $sockets = $this->getAllSockets();
@@ -248,7 +248,7 @@ class DefaultPeerPool extends BasePool implements PoolablePeer {
                // Get all sockets and check them, skip the server socket
                foreach ($sockets as $socketArray) {
                        // Debugging:
-                       /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput(sprintf('POOL: socketArray(%d)=%s', count($socketArray), implode(',', $socketArray)));
+                       /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput(sprintf('DEFAULT-PEER-POOL: socketArray(%d)=%s', count($socketArray), implode(',', $socketArray)));
                        //* DEBUG-DIE: */ die(__METHOD__.':connectionType='.$connectionType.',socketArray='.print_r($socketArray, TRUE));
 
                        // Is connection type set?
@@ -263,12 +263,12 @@ class DefaultPeerPool extends BasePool implements PoolablePeer {
                                throw new InvalidConnectionTypeException(array($this, $connectionType), self::EXCEPTION_INVALID_CONNECTION_TYPE);
                        } elseif ((!empty($connectionType)) && ($socketArray[Poolable::SOCKET_ARRAY_CONN_TYPE] !== $connectionType)) {
                                // Skip unwanted sockets
-                               /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput(sprintf('POOL: Skipping unwanted socket %s of type %s/%s ...', $socketArray[Poolable::SOCKET_ARRAY_INSTANCE]->getSocketResource(), $socketArray[Poolable::SOCKET_ARRAY_CONN_TYPE], $connectionType));
+                               /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput(sprintf('DEFAULT-PEER-POOL: Skipping unwanted socket %s of type %s/%s ...', $socketArray[Poolable::SOCKET_ARRAY_INSTANCE]->getSocketResource(), $socketArray[Poolable::SOCKET_ARRAY_CONN_TYPE], $connectionType));
                                continue;
                        }
 
                        // Debug message
-                       /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput(sprintf('POOL: socketInstance.socketResource=%s,socketInstance.socketProtocol=%s,socketArray[%s]=%s', $socketArray[Poolable::SOCKET_ARRAY_INSTANCE]->getSocketResource(), $socketArray[Poolable::SOCKET_ARRAY_INSTANCE]->getSocketProtocol(), Poolable::SOCKET_ARRAY_CONN_TYPE, $socketArray[Poolable::SOCKET_ARRAY_CONN_TYPE]));
+                       /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput(sprintf('DEFAULT-PEER-POOL: socketInstance.socketResource=%s,socketInstance.socketProtocol=%s,socketArray[%s]=%s', $socketArray[Poolable::SOCKET_ARRAY_INSTANCE]->getSocketResource(), $socketArray[Poolable::SOCKET_ARRAY_INSTANCE]->getSocketProtocol(), Poolable::SOCKET_ARRAY_CONN_TYPE, $socketArray[Poolable::SOCKET_ARRAY_CONN_TYPE]));
 
                        // Init peer address/port
                        $peerAddress = '0.0.0.0';
@@ -281,7 +281,7 @@ class DefaultPeerPool extends BasePool implements PoolablePeer {
                        } // END - if
 
                        // Debug message
-                       /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput(sprintf('POOL: peerAddress=%s,peerPort=%d,unlInstance.addressPart=%s', $peerAddress, $peerPort, $unlInstance->getAddressPart()));
+                       /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput(sprintf('DEFAULT-PEER-POOL: peerAddress=%s,peerPort=%d,unlInstance.addressPart=%s', $peerAddress, $peerPort, $unlInstance->getAddressPart()));
 
                        // If the "peer" IP and recipient is same, use it
                        if ($peerAddress == $unlInstance->getAddressPart()) {
@@ -289,13 +289,15 @@ class DefaultPeerPool extends BasePool implements PoolablePeer {
                                $socketInstance = $socketArray[Poolable::SOCKET_ARRAY_INSTANCE];
 
                                // Debug message
-                               /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput(sprintf('POOL: peerAddress=%s matches with recipient IP address. Taking socketResource=%s,type=%s', $peerAddress, $socketArray[Poolable::SOCKET_ARRAY_INSTANCE]->getSocketResource(), $socketArray[Poolable::SOCKET_ARRAY_CONN_TYPE]));
+                               /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput(sprintf('DEFAULT-PEER-POOL: peerAddress=%s matches with recipient IP address. Taking socketResource=%s,type=%s', $peerAddress, $socketArray[Poolable::SOCKET_ARRAY_INSTANCE]->getSocketResource(), $socketArray[Poolable::SOCKET_ARRAY_CONN_TYPE]));
                                break;
                        } // END - if
                } // END - foreach
 
+               // Trace message
+               /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('DEFAULT-PEER-POOL: socketInstance[]=' . gettype($socketInstance) . ' - EXIT!');
+
                // Return the determined socket instance
-               /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('POOL: socketInstance[]=' . gettype($socketInstance));
                return $socketInstance;
        }
 
index 46ef6cfaf417aea48ccf458f433fb59d014c3649..dcc61469451035ed3a305b80041bbdb45c8643b7 100644 (file)
@@ -17,6 +17,7 @@ use CoreFramework\Factory\ObjectFactory;
 use CoreFramework\Registry\BaseRegistry;
 use CoreFramework\Registry\Register;
 use CoreFramework\Registry\Sub\SubRegistry;
+use CoreFramework\Socket\SocketAlreadyRegisteredException;
 
 /**
  * A Socket registry
@@ -222,7 +223,7 @@ class SocketRegistry extends BaseRegistry implements Register, RegisterableSocke
                // Is the socket already registered?
                if ($this->isSocketRegistered($infoInstance, $socketInstance)) {
                        // Throw the exception
-                       throw new SocketAlreadyRegisteredException(array($infoInstance, $socketInstance), BaseListener::EXCEPTION_SOCKET_ALREADY_REGISTERED);
+                       throw new SocketAlreadyRegisteredException(array($infoInstance, $socketInstance->getSocketResource()), BaseListener::EXCEPTION_SOCKET_ALREADY_REGISTERED);
                } // END - if
 
                // Does the instance exist?
index 9073efe3689a19b840efdb0d12dabc40ca6b0c95..09b1a4895fba5f86d69c649371f851491f3f6f74 100644 (file)
@@ -87,6 +87,9 @@ class NetworkPackageReaderTask extends BaseTask implements Taskable, Visitable {
                // Get package instance
                $packageInstance = NetworkPackageFactory::createNetworkPackageInstance();
 
+               // Debug message
+               /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput(sprintf('NETWORK-PACKAGE-READER-TASK: packageInstance=%s', $packageInstance->__toString()));
+
                // Do we have something to handle?
                if ($packageInstance->isProcessedMessagePending()) {
                        // Trace message
index 38c50eb1820f4f8b57edff8831481687a726d229..6f7e64d9c0b41f4c3017fd2f73ae859df0f30cb5 100644 (file)
@@ -100,7 +100,7 @@ class RawDataPoolMonitorVisitor extends BaseVisitor implements PoolVisitor, List
                // Do monitor here
                /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('RAWDATA-MONITOR-VISITOR: Visiting decoratorInstance=' . $decoratorInstance->__toString() . ' - CALLED!');
                $decoratorInstance->monitorIncomingRawData();
-               /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('RAWDATA-MONITOR-VISITOR: Visiting decoratorInstance=' . $decoratorInstance->__toString() . ' - FINISH');
+               /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('RAWDATA-MONITOR-VISITOR: Visiting decoratorInstance=' . $decoratorInstance->__toString() . ' - EXIT!');
        }
 
 }
index d615b6944ccc0c82479379cb53a7227d399220de..634c1ed83a26ec929172dfb528389a0fa403e390 100644 (file)
@@ -101,7 +101,7 @@ class ActiveTaskVisitor extends BaseVisitor implements TaskVisitor, PoolVisitor,
                // Do "listen" here
                /* DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('ACTIVE-TASK-VISITOR: Visiting listenerInstance=' . $listenerInstance->__toString() . ' - CALLED!');
                $listenerInstance->doListen();
-               /* DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('ACTIVE-TASK-VISITOR: Visiting listenerInstance=' . $listenerInstance->__toString() . ' - FINISH');
+               /* DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('ACTIVE-TASK-VISITOR: Visiting listenerInstance=' . $listenerInstance->__toString() . ' - EXIT!');
        }
 
        /**
index cbce9f062959bfd39cfb33f2cb3176b99637dd6b..0bcb39a41b470cbb947d6297169680f60122b222 100644 (file)
@@ -5,6 +5,9 @@ namespace Hub\Socket;
 // Inport application-specific stuff
 use Hub\Handler\Protocol\HandleableProtocol;
 
+// Import framework stuff
+use CoreFramework\Socket\AbstractSocketException;
+
 /**
  * This exception is thrown when the requested socket is not thrown
  *
index a826fa2a420950df7da2e10bbe6816a3c60f7dde..f79d103f6eecb38fc0a6aad4e21a4a161f621658 100644 (file)
@@ -5,6 +5,9 @@ namespace Hub\Socket;
 // Import application-specific stuff
 use Hub\Helper\Connection\ConnectionHelper;
 
+// Import framework stuff
+use CoreFramework\Socket\AbstractSocketException;
+
 /**
  * This exception is thrown if the socket cannot be shut down is not error 107
  * which is "Transport endpoint not connected".
index 4cd6ed37c872ad744fe45e1fd91766ae075cb3a2..a490a977819c6ccd30e3cfc7a5735397d776e659 100644 (file)
@@ -32,14 +32,14 @@ use CoreFramework\Handler\DataSet\HandleableDataSet;
  */
 interface Networkable extends HandleableDataSet, HubInterface {
        /**
-        * Processes raw data from given resource. This is mostly useful for TCP
-        * package handling and is implemented in the TcpListener class
+        * Processes raw data from given socket instance. This is mostly useful for
+        * package handling and is implemented in the TcpListener class.
         *
         * @param       $socketData     A valid socket resource array
         * @return      void
         * @throws      InvalidResourceException        If the given resource is invalid
         */
-       function processRawDataFromResource (array $socketData);
+       function processRawDataFromSocketArray (array $socketData);
 
        /**
         * Checks whether decoded data is pending for further processing.
diff --git a/core b/core
index 0a6b81dde16619b6d4466cca1ff8ad52226e9384..fc0b718d5c258e187b226e2a088769e5d14fcc1f 160000 (submodule)
--- a/core
+++ b/core
@@ -1 +1 @@
-Subproject commit 0a6b81dde16619b6d4466cca1ff8ad52226e9384
+Subproject commit fc0b718d5c258e187b226e2a088769e5d14fcc1f