]> git.mxchange.org Git - hub.git/commitdiff
Removed old-lost comments, moved two class instances around:
authorRoland Häder <roland@mxchange.org>
Tue, 19 Apr 2011 01:26:58 +0000 (01:26 +0000)
committerRoland Häder <roland@mxchange.org>
Tue, 19 Apr 2011 01:26:58 +0000 (01:26 +0000)
- Removed old-lost comments about the application selector
- Moved class instances around to have the pool listener available in the method
  which checks for newly arrived raw data

27 files changed:
application/hub/config.php
application/hub/data.php
application/hub/exceptions.php
application/hub/exceptions/hub/class_HubAlreadyAnnouncedException.php
application/hub/exceptions/lists/class_InvalidListHashException.php
application/hub/exceptions/lists/class_ListGroupAlreadyAddedException.php
application/hub/exceptions/lists/class_NoListGroupException.php
application/hub/exceptions/peer/class_PeerAlreadyRegisteredException.php
application/hub/exceptions/state/class_InvalidStateException.php
application/hub/exceptions/tags/class_InvalidTagException.php
application/hub/exceptions/tasks/class_InvalidTaskException.php
application/hub/init.php
application/hub/interfaces/package/class_Receivable.php
application/hub/main/class_BaseHubSystem.php
application/hub/main/connectors/query/local/class_LocalQueryConnector.php
application/hub/main/filter/task/node/class_NodeTaskHandlerInitializerFilter.php
application/hub/main/handler/network/class_BaseNetworkPackageHandler.php
application/hub/main/handler/network/tcp/class_TcpNetworkPackageHandler.php
application/hub/main/listener/tcp/class_TcpListener.php
application/hub/main/lists/groups/class_ListGroupList.php
application/hub/main/lists/pool/class_PoolEntriesList.php
application/hub/main/nodes/class_BaseHubNode.php
application/hub/main/package/class_NetworkPackage.php
application/hub/main/pools/class_BasePool.php
application/hub/main/pools/peer/class_DefaultPeerPool.php
application/hub/main/resolver/state/network/class_NetworkStateResolver.php
application/hub/main/tasks/network/class_NetworkPackageReaderTask.php

index d650da5b68e30173bfc6f9aabb6f103ad2d51920..311ea35949a8060a546df0a2964e460a558ce3b3 100644 (file)
@@ -279,6 +279,9 @@ $cfg->setConfigEntry('stacker_outgoing_queue_max_size', 100000);
 // CFG: STACKER-INCOMING-QUEUE-MAX-SIZE
 $cfg->setConfigEntry('stacker_incoming_queue_max_size', 100000);
 
+// CFG: STACKER-RAW-DATA-MAX-SIZE
+$cfg->setConfigEntry('stacker_raw_data_max_size', 100);
+
 // CFG: NEWS-MAIN-LIMIT
 $cfg->setConfigEntry('news_main_limit', 5);
 
index 6e8b67cc09fe31739c914bfbcbbde9dfda9542c3..b023dc256e13a923e1b1e42cff4374792208bf7c 100644 (file)
@@ -5,14 +5,6 @@
  * Please remember that this include file is being loaded *before* the class
  * loader is loading classes from "exceptions", "interfaces" and "main"!
  *
- * You can prevent adding this application to the selector by uncommenting the
- * following line:
- *
- * if ((isset($this)) && (is_object($this)) && ($this->isClass("ApplicationSelector"))) { return; }
- *
- * isset() is required to prevent a warning and is_object() is highly required
- * when the application itself is requested in URL (hint: index.php?app=your_app)
- *
  * @author             Roland Haeder <webmaster@ship-simu.org>
  * @version            0.0.0
  * @copyright  Copyright (c) 2007, 2008 Roland Haeder, 2009 - 2011 Hub Developer Team
index ca9ebde5e25cf812f5f642fbd6fd0c921fbe8f08..fa54a9a20888b0f939267fee430402d4316588ce 100644 (file)
@@ -2,7 +2,6 @@
 /**
  * An include file for setting up the exception handler of the hub
  *
- *
  * @author             Roland Haeder <webmaster@ship-simu.org>
  * @version            0.0
  * @copyright  Copyright (c) 2007 - 2008 Roland Haeder, 2009 - 2011 Hub Developer Team
index 481e8c22901379b04b84dc06dc176473059fe932..8e4e45d8253ed6461a429c999a1a765ce774dc57 100644 (file)
@@ -31,8 +31,9 @@ class HubAlreadyAnnouncedException extends FrameworkException {
         */
        public function __construct (NodeHelper $nodeInstance, $code) {
                // Construct the message
-               $message = sprintf("[%s] This hub is already announced. Please fix this.",
-                       $nodeInstance->__toString()
+               $message = sprintf("[%s:%d] This hub is already announced. Please fix this.",
+                       $nodeInstance->__toString(),
+                       $this->getLine()
                );
 
                // Call parent exception constructor
index 9b48ec464853a06eb3687a2387625dcb1f347a36..8b9006cd8abe4f1710ffaabb8f06c53088904325 100644 (file)
@@ -31,8 +31,9 @@ class InvalidListHashException extends FrameworkException {
         */
        public function __construct (array $messageArray, $code) {
                // Construct the message
-               $message = sprintf("[%s] Hash <span class=\"exception_reason\">%s</span> with key <span class=\"exception_reason\">%s</span> is invalid.",
+               $message = sprintf("[%s:%d] Hash <span class=\"exception_reason\">%s</span> with key <span class=\"exception_reason\">%s</span> is invalid.",
                        $messageArray[0]->__toString(),
+                       $this->getLine(),
                        $messageArray[1],
                        $messageArray[2]
                );
index d47ef3571c1b3b08255e120f46d3309b3f129aaf..7308c9e49600f776f9c3e7034d36ca3c7b0dc034 100644 (file)
@@ -31,8 +31,9 @@ class ListGroupAlreadyAddedException extends FrameworkException {
         */
        public function __construct (array $messageArray, $code) {
                // Construct the message
-               $message = sprintf("[%s] List group <span class=\"exception_reason\">%s</span> has already been added.",
+               $message = sprintf("[%s:%d] List group <span class=\"exception_reason\">%s</span> has already been added.",
                        $messageArray[0]->__toString(),
+                       $this->getLine(),
                        $messageArray[1]
                );
 
index db33a0800bafa0aa766dd268304beee31cb4ee4d..3c666b51ed37ba54e5d65edf84b5e680e4e506b9 100644 (file)
@@ -31,8 +31,9 @@ class NoListGroupException extends FrameworkException {
         */
        public function __construct (array $messageArray, $code) {
                // Construct the message
-               $message = sprintf("[%s] List group <span class=\"exception_reason\">%s</span> was not found.",
+               $message = sprintf("[%s:%d] List group <span class=\"exception_reason\">%s</span> was not found.",
                        $messageArray[0]->__toString(),
+                       $this->getLine(),
                        $messageArray[1]
                );
 
index 55d7df8d21e15bceeece5bd79282620c7724329f..c33c9db2c16c9532662026bb55fc4cd78ee0bc8e 100644 (file)
@@ -31,8 +31,9 @@ class PeerAlreadyRegisteredException extends FrameworkException {
         */
        public function __construct (array $messageArray, $code) {
                // Construct the message
-               $message = sprintf("[%s] Sender %s is already registered.",
+               $message = sprintf("[%s:%d] Sender %s is already registered.",
                        $messageArray[0]->__toString(),
+                       $this->getLine(),
                        $messageArray[NetworkPackage::INDEX_PACKAGE_SENDER]
                );
 
index 8e0a33936b61884d10f722688d3c28aa76995f5e..b89d74f6c634452d5afac5c15f06a54e910cb300 100644 (file)
@@ -31,8 +31,9 @@ class InvalidStateException extends FrameworkException {
         */
        public function __construct (Stateable $stateInstance, $code) {
                // Construct the message
-               $message = sprintf("[%s] Unexpected state detected.",
-                       $nodeSateInstance->__toString()
+               $message = sprintf("[%s:%d] Unexpected state detected.",
+                       $nodeSateInstance->__toString(),
+                       $this->getLine()
                );
 
                // Call parent exception constructor
index 6a12374400826e73368b834ecf6331147e8c1cb6..3efba6a87b05815562dc1adaa824f54c98ad37f6 100644 (file)
@@ -31,8 +31,9 @@ class InvalidTagException extends FrameworkException {
         */
        public function __construct (array $messageArray, $code) {
                // Construct the message
-               $message = sprintf("[%s] Tag <span class=\"exception_reason\">%s</span> is invalid.",
+               $message = sprintf("[%s:%d] Tag <span class=\"exception_reason\">%s</span> is invalid.",
                        $messageArray[0]->__toString(),
+                       $this->getLine(),
                        $messageArray[1]
                );
 
index 5725e734042e3bcc38dd8b0af9c5ede9c676dbf7..e4e3d8b92c9a4209a9b9311a3894b4fb4dea63a9 100644 (file)
@@ -31,8 +31,9 @@ class InvalidTaskException extends FrameworkException {
         */
        public function __construct (array $messageArray, $code) {
                // Construct the message
-               $message = sprintf("[%s] Current task is invalid which should not happen.",
-                       $messageArray[0]->__toString()
+               $message = sprintf("[%s:%d] Current task is invalid which should not happen.",
+                       $messageArray[0]->__toString(),
+                       $this->getLine()
                );
 
                // Call parent exception constructor
index b6e43954592d7dbf03b80f7ca7836b985f828e54..8ecef8e7b7ba7f57ffe858a151f616f81f20f168 100644 (file)
@@ -5,14 +5,6 @@
  * Please remember that this include file is being loaded *before* the class
  * loader is loading classes from "exceptions", "interfaces" and "main"!
  *
- * You can prevent adding this application to the selector by uncommenting the
- * following line:
- *
- * if ((isset($this)) && (is_object($this)) && ($this->isClass("ApplicationSelector"))) { return; }
- *
- * isset() is required to prevent a warning and is_object() is highly required
- * when the application itself is requested in URL (hint: index.php?app=your_app)
- *
  * @author             Roland Haeder <webmaster@ship-simu.org>
  * @version            0.0
  * @copyright  Copyright (c) 2007 - 2008 Roland Haeder, 2009 - 2011 Hub Developer Team
index 9f52f77dd095643f861c504dd27ef65b8c987060..e8156d2aed17ca27eb45be3c52981f1ab7d08098 100644 (file)
@@ -25,9 +25,10 @@ interface Receivable extends FrameworkInterface {
        /**
         * Checks wether new raw data from the socket has arrived
         *
+        * @param       $poolInstance   An instance of a PoolableListener class
         * @return      $hasArrived             Wether raw package data has arrived at a socket
         */
-       function isNewRawDataPending ();
+       function isNewRawDataPending (PoolableListener $poolInstance);
 
        /**
         * Checks wether a new package has arrived
index 9e61ae2b38ecdc9ebd73cc23a6f0876c972d62e1..d9f33239bdb45f494049ea0d71e5b52bb683c2f3 100644 (file)
@@ -52,6 +52,11 @@ class BaseHubSystem extends BaseFrameworkSystem {
         */
        private $stateInstance = null;
 
+       /**
+        * Listener pool instance
+        */
+       private $listenerPoolInstance = null;
+
        /**
         * Protected constructor
         *
@@ -158,6 +163,25 @@ class BaseHubSystem extends BaseFrameworkSystem {
                return $this->stateInstance;
        }
 
+       /**
+        * Setter for listener pool instance
+        *
+        * @param       $listenerPoolInstance   Our new listener pool instance
+        * @return      void
+        */
+       protected final function setListenerPoolInstance (PoolableListener $listenerPoolInstance) {
+               $this->listenerPoolInstance = $listenerPoolInstance;
+       }
+
+       /**
+        * Getter for listener pool instance
+        *
+        * @return      $listenerPoolInstance   Our current listener pool instance
+        */
+       public final function getListenerPoolInstance () {
+               return $this->listenerPoolInstance;
+       }
+
        /**
         * Shuts down a given socket resource. This method does only ease calling
         * the right visitor.
index d9e826827b82423a62a3981c2b98aa017a41b84d..f77945448eb2f0d87825af376e3acf193b00bb0a 100644 (file)
@@ -117,6 +117,15 @@ class LocalQueryConnector extends BaseQueryConnector implements Connectable, Vis
                if (!$this->getIteratorInstance()->valid()) {
                        // Rewind to the beginning for next loop
                        $this->getIteratorInstance()->rewind();
+
+                       // Still not valid?
+                       if ($this->getIteratorInstance()->valid()) {
+                               /*
+                                * Then silently abort here because the queue is empty and to
+                                * save some calls.
+                                */
+                               return;
+                       } // END - if
                } // END - if
 
                // Try to execute the task
index ac4ffff0d3e3fb7cd034965fa77b9956f8026509..34dff9338749438b55e0e0a4bff51e5dbc953ec6 100644 (file)
@@ -58,6 +58,9 @@ class NodeTaskHandlerInitializerFilter extends BaseFilter implements Filterable
                // Get node instance
                $nodeInstance = Registry::getRegistry()->getInstance('node');
 
+               // Get the list instance here
+               $listInstance = $nodeInstance->getListenerPoolInstance()->getPoolEntriesInstance();
+
                // Get a new task handler instance
                $handlerInstance = ObjectFactory::createObjectByConfiguredName('task_handler_class');
 
@@ -68,7 +71,7 @@ class NodeTaskHandlerInitializerFilter extends BaseFilter implements Filterable
                $handlerInstance->registerTask('socket_listener', $taskInstance);
 
                // Generate package reader task
-               $taskInstance = ObjectFactory::createObjectByConfiguredName('hub_package_reader_task_class');
+               $taskInstance = ObjectFactory::createObjectByConfiguredName('hub_package_reader_task_class', array($nodeInstance->getListenerPoolInstance()));
 
                // Network package reader, needs to be delayed a little
                $handlerInstance->registerTask('network_package_reader', $taskInstance);
@@ -97,9 +100,6 @@ class NodeTaskHandlerInitializerFilter extends BaseFilter implements Filterable
                // Register it
                $handlerInstance->registerTask('update_check', $taskInstance);
 
-               // Get the list instance here
-               $listInstance = $nodeInstance->getListenerPoolInstance()->getPoolEntriesInstance();
-
                // Prepare a ping task
                $taskInstance = ObjectFactory::createObjectByConfiguredName('hub_ping_task_class', array($listInstance));
 
index 2cd9d1661f04fc5d821a9d7e10de82e365ec5de9..c563faca7bec50d108ef45c493f2f056cf443653 100644 (file)
@@ -32,11 +32,15 @@ class BaseNetworkPackageHandler extends BaseHandler {
        const SOCKET_ERROR_UNHANDLED              = 'unhandled_package';  // Unhandled raw data (not bad)
 
        // - Package errors
-       const PACKAGE_ERROR_INVALID_DATA         = 'invalid_data';    // Invalid data in package found
-       const PACKAGE_ERROR_INCOMPLETE_DATA      = 'incomplete_data'; // Incomplete data sent (e.g. field is missing)
-       const PACKAGE_ERROR_INVALID_CONTENT      = 'invalid_content'; // Content is invalid (e.g. not well-formed)
-       const PACKAGE_ERROR_RECIPIENT_MISMATCH   = 'recipient_error'; // Recipient is not us
-       const PACKAGE_LEVEL_CHECK_OKAY           = 'checked_package'; // Package is fine
+       const PACKAGE_ERROR_INVALID_DATA       = 'invalid_data';    // Invalid data in package found
+       const PACKAGE_ERROR_INCOMPLETE_DATA    = 'incomplete_data'; // Incomplete data sent (e.g. field is missing)
+       const PACKAGE_ERROR_INVALID_CONTENT    = 'invalid_content'; // Content is invalid (e.g. not well-formed)
+       const PACKAGE_ERROR_RECIPIENT_MISMATCH = 'recipient_error'; // Recipient is not us
+       const PACKAGE_LEVEL_CHECK_OKAY         = 'checked_package'; // Package is fine
+
+       // Package data
+       const PACKAGE_DECODED_DATA = 'decoded_data';
+       const PACKAGE_ERROR_CODE   = 'error_code';
 
        /**
         * Error code from socket
@@ -53,6 +57,9 @@ class BaseNetworkPackageHandler extends BaseHandler {
                // Call parent constructor
                parent::__construct($className);
 
+               // Set error code to 'unknown'
+               $this->setErrorCode(self::SOCKET_ERROR_UNKNOWN);
+
                // Get an input stream instance
                $streamInstance = ObjectFactory::createObjectByConfiguredName('node_raw_data_input_stream_class', array($this));
 
@@ -85,10 +92,13 @@ class BaseNetworkPackageHandler extends BaseHandler {
         * @return      void
         */
        protected function addDecodedDataToStacker ($decodedData) {
-               // Add it
+               /*
+                * Add the deocoded data and error code to the stacker so other classes
+                * (e.g. NetworkPackage) can "pop" it from the stacker.
+                */
                $this->getStackerInstance()->pushNamed('raw_data', array(
-                       'decoded_data' => $decodedData,
-                       'error_code'   => $this->getErrorCode()
+                       self::PACKAGE_DECODED_DATA => $decodedData,
+                       self::PACKAGE_ERROR_CODE   => $this->getErrorCode()
                ));
        }
 
@@ -98,9 +108,10 @@ class BaseNetworkPackageHandler extends BaseHandler {
         *
         * @param       $packageData    Raw package data
         * @return      $matches                Wether it matches
+        * @todo        This method will be moved to a better place
         */
        protected function ifRecipientMatchesOwnAddress (array $packageData) {
-               // Construct own address first,
+               // Construct own address first
                $ownAddress = Registry::getRegistry()->getInstance('node')->getAddressPort($this);
 
                // Does it match?
index ab841180d8c4d622ce920567a5ddc45e71f894de..56a6fe5bcfba6476aa4894b97b56175e583a1372 100644 (file)
@@ -97,8 +97,8 @@ class TcpNetworkPackageHandler extends BaseNetworkPackageHandler implements Netw
                        $decodedData = $this->getInputStreamInstance()->streamData($rawData);
                }
 
-               // Add the (maybe above decoded) data and error code to the stacker
-               $this->addRawDataToStacker($decodedData);
+               // Add the (maybe above decoded) data to the stacker
+               $this->addDecodedDataToStacker($decodedData);
        }
 }
 
index 005831ffc2f9c5e4676e3805fa910d765aba8cf6..355019c504600c1039cb472b041c1c6e375319c9 100644 (file)
@@ -162,10 +162,10 @@ class TcpListener extends BaseListener implements Listenable {
                $this->setIteratorInstance($iteratorInstance);
 
                // Initialize the network package handler
-               $packageInstance = ObjectFactory::createObjectByConfiguredName('tcp_network_package_handler_class');
+               $handlerInstance = ObjectFactory::createObjectByConfiguredName('tcp_network_package_handler_class');
 
                // Set it in this class
-               $this->setPackageInstance($packageInstance);
+               $this->setHandlerInstance($handlerInstance);
 
                // Output message
                $this->debugOutput('LISTENER: TCP listener now ready on IP ' . $this->getListenAddress() . ', port ' . $this->getListenPort() . ' for service.');
@@ -236,7 +236,7 @@ class TcpListener extends BaseListener implements Listenable {
                if ($currentSocket != $this->getSocketResource()) {
                        // ... or else it will raise warnings like 'Transport endpoint is not connected'
                        //* NOISY-DEBUG: */ $this->debugOutput('LISTENER: currentSocket=' . $currentSocket);
-                       $this->getPackageInstance()->processResourceRawData($currentSocket);
+                       $this->getHandlerInstance()->processResourceRawData($currentSocket);
                } // END - if
 
                // Advance to next entry. This should be the last line
index 045569349719349e9f1d00f55991800cecbca65b..9499afe58349015170479469aa4aece680061e92 100644 (file)
@@ -54,6 +54,7 @@ class ListGroupList extends BaseList implements Listable {
        public function getListIterator () {
                $this->partialStub('Please implement this method.');
        }
+}
 
 // [EOF]
 ?>
index 4c220837390bc8a6c5f56b518bc7ef62426eafe7..485f2cd8449b0a456651f8fc1f3b5c9584bafda1 100644 (file)
@@ -41,8 +41,8 @@ class PoolEntriesList extends BaseList implements Listable {
                // Get new instance
                $listInstance = new PoolEntriesList();
 
-               // Add generic group
-               $listInstance->addGroup('generic');
+               // Add 'pool' group
+               $listInstance->addGroup('pool');
 
                // Return the prepared instance
                return $listInstance;
index 286fc00516b81f3362e7f918df250fd3ac16ee03..c312de2bc340da00eec660844253f419a4e3465c 100644 (file)
@@ -48,11 +48,6 @@ class BaseHubNode extends BaseHubSystem implements Updateable {
         */
        private $queueConnectorInstance = null;
 
-       /**
-        * Listener pool instance
-        */
-       private $listenerPoolInstance = null;
-
        /**
         * Wether this node is anncounced (KEEP ON false!)
         * @deprecated
@@ -110,25 +105,6 @@ class BaseHubNode extends BaseHubSystem implements Updateable {
                return $this->getConfigInstance()->getConfigEntry('node_id');
        }
 
-       /**
-        * Setter for listener pool instance
-        *
-        * @param       $listenerPoolInstance   Our new listener pool instance
-        * @return      void
-        */
-       private final function setListenerPoolInstance (PoolableListener $listenerPoolInstance) {
-               $this->listenerPoolInstance = $listenerPoolInstance;
-       }
-
-       /**
-        * Getter for listener pool instance
-        *
-        * @return      $listenerPoolInstance   Our current listener pool instance
-        */
-       public final function getListenerPoolInstance () {
-               return $this->listenerPoolInstance;
-       }
-
        /**
         * Setter for session id
         *
index 1f9b5d3ba6101097638233c55ded0a061d7bba77..bdadfa7f8a4f296f04a2dbb4d4d64c58207fd1e0 100644 (file)
@@ -435,7 +435,7 @@ class NetworkPackage extends BaseFrameworkSystem implements Deliverable, Receiva
                // Sanity check if we have packages waiting for delivery
                if (!$this->isPackageWaitingForDelivery()) {
                        // This is not fatal but should be avoided
-                       $this->debugOutput('PACKAGE: No package is waiting for delivery, but ' . __FUNCTION__ . ' was called.');
+                       $this->debugOutput('PACKAGE: No package is waiting for delivery, but ' . __METHOD__ . ' was called.');
                        return;
                } // END - if
 
@@ -461,10 +461,12 @@ class NetworkPackage extends BaseFrameworkSystem implements Deliverable, Receiva
        /**
         * Checks wether new raw package data has arrived at a socket
         *
+        * @param       $poolInstance   An instance of a PoolableListener class
         * @return      $hasArrived             Wether new raw package data has arrived for processing
         */
-       public function isNewRawDataPending () {
+       public function isNewRawDataPending (PoolableListener $poolInstance) {
                // @TODO Add some content here
+               $this->partialStub('Do something here. poolInstance=' . $poolInstance->__toString());
        }
 
        /**
index 458dc656dac16e5d977308a95d64dfb866403ff3..462d3ad1f6c9e06a42d36bc14a5da402f9a45d0a 100644 (file)
@@ -76,7 +76,7 @@ class BasePool extends BaseHubSystem implements Visitable {
         * @return      void
         */
        protected final function addPoolEntry ($poolEntry) {
-               $this->getPoolEntriesInstance()->addEntry('generic', $poolEntry);
+               $this->getPoolEntriesInstance()->addEntry('pool', $poolEntry);
        }
 
        /**
index daab465ee1cf9e348b03d6f3862d649f90c785bf..11c91f508acec4546df495e269ecf4d0781f2bd2 100644 (file)
@@ -121,7 +121,7 @@ class DefaultPeerPool extends BasePool implements PoolablePeer {
         */
        public final function getAllSockets () {
                // Get the list
-               $sockets = $this->getArrayFromList('generic');
+               $sockets = $this->getArrayFromList('pool');
 
                // Return it
                return $sockets;
index fc9ed75077b3d52a1757c5df1905979a7459c38d..8fcdbccaac1cd0643f8db3b1538176663d1a3683 100644 (file)
@@ -80,8 +80,8 @@ class NetworkStateResolver extends BaseStateResolver implements StateResolver {
                        // @TODO On some systems it is 134, on some 107?
                        $errorCode = BaseNetworkPackageHandler::SOCKET_ERROR_TRANSPORT_ENDPOINT;
                } elseif (is_int($errorCode)) {
-                       // Debug output (because we might want to handle it like the above(s)
-                       $this->debugOutput(__METHOD__ . ': UNKNOWN ERROR CODE = ' . $errorCode, ', MESSAGE = ' . socket_strerror($errorCode));
+                       // Unhandled error code detected, so first debug it because we may want to handle it like the others
+                       $this->debugOutput('[' . __METHOD__ . ':' . __LINE__ . '] UNKNOWN ERROR CODE = ' . $errorCode, ', MESSAGE = ' . socket_strerror($errorCode));
 
                        // Change it only in this class
                        $errorCode = BaseNetworkPackageHandler::SOCKET_ERROR_UNKNOWN;
index 3f847aa83f92c0e09e62276af7607b1c2d72498d..18b730ff0f397dee52ac22ef9492744749b93d52 100644 (file)
@@ -35,12 +35,16 @@ class NetworkPackageReaderTask extends BaseTask implements Taskable, Visitable {
        /**
         * Creates an instance of this class
         *
+        * @param       $poolInstance   An instance of a PoolableListener class
         * @return      $taskInstance   An instance of a Taskable/Visitable class
         */
-       public static final function createNetworkPackageReaderTask () {
+       public static final function createNetworkPackageReaderTask (PoolableListener $poolInstance) {
                // Get new instance
                $taskInstance = new NetworkPackageReaderTask();
 
+               // Set the listener instance here
+               $taskInstance->setListenerPoolInstance($poolInstance);
+
                // Return the prepared instance
                return $taskInstance;
        }
@@ -66,7 +70,7 @@ class NetworkPackageReaderTask extends BaseTask implements Taskable, Visitable {
                $packageInstance = NetworkPackageFactory::createNetworkPackageInstance();
 
                // Do we have something to handle?
-               if ($packageInstance->isNewRawDataPending()) {
+               if ($packageInstance->isNewRawDataPending($this->getListenerPoolInstance())) {
                        // We have to handle raw data from the socket
                        $packageInstance->handleIncomingSocketRawData();
                } elseif ($packageInstance->isNewPackageArrived()) {