]> git.mxchange.org Git - hub.git/commitdiff
Continued:
authorRoland Häder <roland@mxchange.org>
Mon, 26 Oct 2020 06:25:47 +0000 (07:25 +0100)
committerRoland Häder <roland@mxchange.org>
Mon, 26 Oct 2020 06:25:47 +0000 (07:25 +0100)
- added missing fields senderAddress, senderPort, recipientType and status

Signed-off-by: Roland Häder <roland@mxchange.org>
application/hub/classes/handler/package/class_NetworkPackageHandler.php
application/hub/classes/package/deliverable/class_PackageData.php
contrib/update_year.sh

index f489d980dcb6f5ef01c3f0c5a4bc1a971953e0b7..076b9c23f5de4b0b3253783ed84e0e3838c67a3b 100644 (file)
@@ -737,7 +737,11 @@ class NetworkPackageHandler extends BaseHubHandler implements Deliverable, Recei
                        return NULL;
                } // END - if
 
-               // Fake array
+               // Fake package instance
+               $packageInstance = new NetworkPackageHandler();
+
+               // Set all fields
+               //$packageInstance->set
                $data = array(
                        self::PACKAGE_CONTENT_SENDER           => $senderId,
                        self::PACKAGE_CONTENT_MESSAGE          => $content,
@@ -746,7 +750,13 @@ class NetworkPackageHandler extends BaseHubHandler implements Deliverable, Recei
 
                // Hash content and sender id together, use scrypt
                //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('NETWORK-PACKAGE: senderId=' . $senderId . ',content()=' . strlen($content));
-               $hash = FrameworkFeature::callFeature('hubcoin_reward', 'generateHash', array($senderId . ':' . $content . ':' . $this->determineSenderPrivateKeyHash($data)));
+               $hash = FrameworkFeature::callFeature('hubcoin_reward', 'generateHash', array(
+                       sprintf('%s:%s:%s',
+                               $senderId,
+                               $content,
+                               $this->determineSenderPrivateKeyHash($data)
+                       )
+               ));
 
                // Debug message
                //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('NETWORK-PACKAGE: hash=' . $hash . ' - EXIT!');
@@ -827,10 +837,8 @@ class NetworkPackageHandler extends BaseHubHandler implements Deliverable, Recei
                        $this->getHashFromContent($compressed)
                );
 
-               // Debug message
-               //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('NETWORK-PACKAGE: Enqueueing package for recipientType=' . $helperInstance->getRecipientType() . ' ...');
-
                // Make sure required data is there
+               //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('NETWORK-PACKAGE: Enqueueing package for recipientType=' . $helperInstance->getRecipientType() . ' ...');
                assert(!empty($content));
                assert($this->getNodeInstance()->getSessionId() != '');
 
@@ -880,15 +888,14 @@ class NetworkPackageHandler extends BaseHubHandler implements Deliverable, Recei
         */
        public function isPackageDeclared () {
                // Check whether the stacker is not empty
+               //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('NETWORK-PACKAGE: CALLED!');
                $isDeclared = (
                        ($this->getStackInstance()->isStackInitialized(self::STACKER_NAME_DECLARED)) &&
                        (!$this->getStackInstance()->isStackEmpty(self::STACKER_NAME_DECLARED))
                );
 
-               // Trace message
-               //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput(sprintf('NETWORK-PACKAGE: isDeclared=%d - EXIT!', intval($isDeclared)));
-
                // Return the result
+               //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput(sprintf('NETWORK-PACKAGE: isDeclared=%d - EXIT!', intval($isDeclared)));
                return $isDeclared;
        }
 
@@ -899,12 +906,11 @@ class NetworkPackageHandler extends BaseHubHandler implements Deliverable, Recei
         */
        public function isPackageWaitingForDelivery () {
                // Check whether the stacker is not empty
+               //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('NETWORK-PACKAGE: CALLED!');
                $isWaitingDelivery = (($this->getStackInstance()->isStackInitialized(self::STACKER_NAME_OUTGOING)) && (!$this->getStackInstance()->isStackEmpty(self::STACKER_NAME_OUTGOING)));
 
-               // Trace message
-               //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput(sprintf('NETWORK-PACKAGE: isWaitingDelivery=%d - EXIT!', intval($isWaitingDelivery)));
-
                // Return the result
+               //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput(sprintf('NETWORK-PACKAGE: isWaitingDelivery=%d - EXIT!', intval($isWaitingDelivery)));
                return $isWaitingDelivery;
        }
 
@@ -915,12 +921,11 @@ class NetworkPackageHandler extends BaseHubHandler implements Deliverable, Recei
         */
        public function isEncodedDataPending () {
                // Check whether the stacker is not empty
+               //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('NETWORK-PACKAGE: CALLED!');
                $isPending = (($this->getStackInstance()->isStackInitialized(self::STACKER_NAME_OUTGOING_STREAM)) && (!$this->getStackInstance()->isStackEmpty(self::STACKER_NAME_OUTGOING_STREAM)));
 
-               // Trace message
-               //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput(sprintf('NETWORK-PACKAGE: isPending=%d - EXIT!', intval($isPending)));
-
                // Return the result
+               //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput(sprintf('NETWORK-PACKAGE: isPending=%d - EXIT!', intval($isPending)));
                return $isPending;
        }
 
@@ -1344,6 +1349,7 @@ class NetworkPackageHandler extends BaseHubHandler implements Deliverable, Recei
         */
        public function removeFirstFailedPackage () {
                // Get the package again
+               /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('NETWORK-PACKAGE: CALLED!');
                $packageInstance = $this->getStackInstance()->getNamed(self::STACKER_NAME_DECLARED);
 
                // Is the package status 'failed'?
@@ -1354,6 +1360,9 @@ class NetworkPackageHandler extends BaseHubHandler implements Deliverable, Recei
 
                // Remove this entry
                $this->getStackInstance()->popNamed(self::STACKER_NAME_DECLARED);
+
+               // Trace message
+               /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('NETWORK-PACKAGE: EXIT!');
        }
 
        /**
@@ -1364,6 +1373,7 @@ class NetworkPackageHandler extends BaseHubHandler implements Deliverable, Recei
         */
        public function decodeRawContent ($rawPackageContent) {
                // Use the separator '#' to "decode" it
+               //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput(sprintf('NETWORK-PACKAGE: rawPackageContent()=%d - CALLED!', strlen($rawPackageContent)));
                $decodedArray = explode(self::PACKAGE_DATA_SEPARATOR, $rawPackageContent);
 
                // Debug message
@@ -1385,6 +1395,7 @@ class NetworkPackageHandler extends BaseHubHandler implements Deliverable, Recei
                $packageInstance->setPrivateKeyHash($decodedArray[self::INDEX_PACKAGE_PRIVATE_KEY_HASH]);
 
                // And return it
+               //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput(sprintf('NETWORK-PACKAGE: packageInstance=%s - EXIT!', $packageInstance->__toString()));
                return $packageInstance;
        }
 
index a37f978a87daf8c73666cbac0f88cf5dd40839dd..56bc31ee375b8be75a1ba4f86d7a48a557de5f51 100644 (file)
@@ -42,6 +42,26 @@ class PackageData extends BaseHubSystem implements DeliverablePackage, Registera
         */
        private $packageContent;
 
+       /**
+        * Sender address
+        */
+       private $senderAddress;
+
+       /**
+        * Sender port
+        */
+       private $senderPort;
+
+       /**
+        * Recipient type
+        */
+       private $recipientType;
+
+       /**
+        * Status
+        */
+       private $status;
+
        /**
         * Protected constructor
         *
@@ -84,6 +104,82 @@ class PackageData extends BaseHubSystem implements DeliverablePackage, Registera
                $this->packageContent = $packageContent;
        }
 
+       /**
+        * Getter for sender address
+        *
+        * @return      $senderAddress          Sender address
+        */
+       public function getSenderAddress () {
+               return $this->senderAddress;
+       }
+
+       /**
+        * Setter for sender address
+        *
+        * @param       $senderAddress          Sender address
+        * @return      void
+        */
+       public function setSenderAddress ($senderAddress) {
+               $this->senderAddress = $senderAddress;
+       }
+
+       /**
+        * Getter for sender port
+        *
+        * @return      $senderPort             Sender port
+        */
+       public function getSenderPort () {
+               return $this->senderPort;
+       }
+
+       /**
+        * Setter for sender port
+        *
+        * @param       $senderPort             Sender port
+        * @return      void
+        */
+       public function setSenderPort ($senderPort) {
+               $this->senderPort = $senderPort;
+       }
+
+       /**
+        * Getter for recipient type
+        *
+        * @return      $recipientType  Recipient type
+        */
+       public function getRecipientType () {
+               return $this->recipientType;
+       }
+
+       /**
+        * Setter for recipient type
+        *
+        * @param       $recipientType  Recipient type
+        * @return      void
+        */
+       public function setRecipientType ($recipientType) {
+               $this->recipientType = $recipientType;
+       }
+
+       /**
+        * Getter for status
+        *
+        * @return      $status         Status
+        */
+       public function getStatus () {
+               return $this->status;
+       }
+
+       /**
+        * Setter for status
+        *
+        * @param       $status         Status
+        * @return      void
+        */
+       public function setStatus ($status) {
+               $this->status = $status;
+       }
+
        /**
         * Getter for content hash
         *
index 560da6111de22b7e39bde3c38044d0ec3d155ef6..546f96ae0874260da4dc63b37428b4e6cb500aa1 100755 (executable)
@@ -1,4 +1,4 @@
 #!/bin/sh
 
 # Really lame ...
-find application/ -type f -print0 | xargs -0 sed -i 's/2012 Apt-Proxy/2012 - 2018 Hub/g'
+find application/ -type f -print0 | xargs -0 sed -i 's/2018 Hub/2020 Hub/g'