]> git.mxchange.org Git - hub.git/commitdiff
Renamed some methods to make their purpose more clear, extended comment
authorRoland Häder <roland@mxchange.org>
Tue, 12 Apr 2011 00:11:35 +0000 (00:11 +0000)
committerRoland Häder <roland@mxchange.org>
Tue, 12 Apr 2011 00:11:35 +0000 (00:11 +0000)
application/hub/main/package/class_NetworkPackage.php

index c7e37ab8c4c6a49b573f033dcf05d4360cd17b8d..a9a8a543e1b7d702f9a648b80305a4199fe38ad6 100644 (file)
@@ -167,7 +167,7 @@ class NetworkPackage extends BaseFrameworkSystem implements Deliverable, Registe
         * @param       $packageData    Raw package data in an array
         * @return      void
         */
-       private function deliverPackage (array $packageData) {
+       private function declareRawPackageData (array $packageData) {
                /*
                 * We need to disover every recipient, just in case we have a
                 * multi-recipient entry like 'upper' is. 'all' may be a not so good
@@ -205,12 +205,15 @@ class NetworkPackage extends BaseFrameworkSystem implements Deliverable, Registe
        }
 
        /**
-        * Sends a raw package out
+        * Delivers raw package data. In short, this will discover the raw socket
+        * resource through a discovery class (which will analyse the receipient of
+        * the package), register the socket with the connection (handler/helper?)
+        * instance and finally push the raw data on our outgoing queue.
         *
         * @param       $packageData    Raw package data in an array
         * @return      void
         */
-       private function sendRawPackage (array $packageData) {
+       private function deliverRawPackageData (array $packageData) {
                /*
                 * This package may become big, depending on the shared object size or
                 * delivered message size which shouldn't be so long (to save
@@ -250,7 +253,7 @@ class NetworkPackage extends BaseFrameworkSystem implements Deliverable, Registe
         * @param       $packageData    Raw package data
         * @return      void
         */
-       private function sendOutgoingPackage (array $packageData) {
+       private function sendOutgoingRawPackageData (array $packageData) {
                // Get the right connection instance
                $connectionInstance = SocketRegistry::createSocketRegistry()->getHandlerInstanceFromPackageData($packageData);
 
@@ -334,7 +337,7 @@ class NetworkPackage extends BaseFrameworkSystem implements Deliverable, Registe
         *
         * @return      $isWaitingDelivery      Wether a package is waiting for delivery
         */
-       public function isPackageWaitingDelivery () {
+       public function isPackageWaitingForDelivery () {
                // Check wether the stacker is not empty
                $isWaitingDelivery = (($this->getStackerInstance()->isStackInitialized(self::STACKER_NAME_OUTGOING)) && (!$this->getStackerInstance()->isStackEmpty(self::STACKER_NAME_OUTGOING)));
 
@@ -364,8 +367,8 @@ class NetworkPackage extends BaseFrameworkSystem implements Deliverable, Registe
                // with the first one.
                $packageData = $this->getStackerInstance()->getNamed(self::STACKER_NAME_UNDECLARED);
 
-               // Finally, deliver the package
-               $this->deliverPackage($packageData);
+               // Declare the raw package data for delivery
+               $this->declareRawPackageData($packageData);
 
                // And remove it finally
                $this->getStackerInstance()->popNamed(self::STACKER_NAME_UNDECLARED);
@@ -390,7 +393,7 @@ class NetworkPackage extends BaseFrameworkSystem implements Deliverable, Registe
                $packageData = $this->getStackerInstance()->getNamed(self::STACKER_NAME_DECLARED);
 
                // And send it
-               $this->sendRawPackage($packageData);
+               $this->deliverRawPackageData($packageData);
 
                // And remove it finally
                $this->getStackerInstance()->popNamed(self::STACKER_NAME_DECLARED);
@@ -406,7 +409,7 @@ class NetworkPackage extends BaseFrameworkSystem implements Deliverable, Registe
                $this->sendBackBufferBytes();
 
                // Sanity check if we have packages waiting for delivery
-               if (!$this->isPackageWaitingDelivery()) {
+               if (!$this->isPackageWaitingForDelivery()) {
                        // This is not fatal but should be avoided
                        // @TODO Add some logging here
                        return;
@@ -417,7 +420,7 @@ class NetworkPackage extends BaseFrameworkSystem implements Deliverable, Registe
 
                try {
                        // Now try to send it
-                       $this->sendOutgoingPackage($packageData);
+                       $this->sendOutgoingRawPackageData($packageData);
                        die("O!\n");
 
                        // And remove it finally