]> git.mxchange.org Git - hub.git/commitdiff
Continued:
authorRoland Häder <roland@mxchange.org>
Wed, 2 Dec 2020 04:56:14 +0000 (05:56 +0100)
committerRoland Häder <roland@mxchange.org>
Wed, 2 Dec 2020 04:56:14 +0000 (05:56 +0100)
- removed PackageData->$rawXml instance and used $packageContent instead
- used ApplicationEntryPoint::exitApplication() instead of die()
- updated core framework

Signed-off-by: Roland Häder <roland@mxchange.org>
15 files changed:
application/hub/classes/dht/node/class_NodeDhtFacade.php
application/hub/classes/discovery/recipient/package/class_PackageRecipientDiscovery.php
application/hub/classes/factories/socket/class_SocketFactory.php
application/hub/classes/handler/chunks/class_ChunkHandler.php
application/hub/classes/handler/package/class_NetworkPackageHandler.php
application/hub/classes/info/connection/class_ConnectionInfo.php
application/hub/classes/nodes/class_BaseHubNode.php
application/hub/classes/package/deliverable/class_PackageData.php
application/hub/classes/package/fragmenter/class_PackageFragmenter.php
application/hub/classes/recipient/dht/class_DhtRecipient.php
application/hub/classes/registry/socket/class_SocketRegistry.php
application/hub/classes/tags/package/class_PackageTags.php
application/hub/classes/tools/hub/class_HubTools.php
application/hub/interfaces/delivery/package/class_DeliverablePackage.php
core

index 3b19a24cedb5ad4715074fdd6dc5ce215daa58a6..2d43958cfdd718cdf5feb6d303b7e33b4e9fb54f 100644 (file)
@@ -12,6 +12,7 @@ use Org\Shipsimu\Hub\Network\Package\DeliverablePackage;
 
 // Import framework stuff
 use Org\Mxchange\CoreFramework\Bootstrap\FrameworkBootstrap;
+use Org\Mxchange\CoreFramework\EntryPoint\ApplicationEntryPoint;
 use Org\Mxchange\CoreFramework\Factory\Database\Frontend\DatabaseFrontendFactory;
 use Org\Mxchange\CoreFramework\Factory\ObjectFactory;
 use Org\Mxchange\CoreFramework\Handler\DataSet\HandleableDataSet;
@@ -199,7 +200,7 @@ class NodeDhtFacade extends BaseDht implements DistributableNode, Registerable {
                }
 
                // Return node data
-               //* DEBUG-DIE: */ die(sprintf('[%s:%d]: nodeData=%s', __METHOD__, __LINE__, print_r($nodeData, TRUE)));
+               //* DEBUG-DIE: */ ApplicationEntryPoint::exitApplication(sprintf('[%s:%d]: nodeData=%s', __METHOD__, __LINE__, print_r($nodeData, TRUE)));
                /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput(sprintf('NODE-DHT-FACADE: nodeData()=%d - EXIT!', count($nodeData)));
                return $nodeData;
        }
@@ -213,14 +214,14 @@ class NodeDhtFacade extends BaseDht implements DistributableNode, Registerable {
        public function findNodeByUniversalNodeLocator (LocateableNode $locatorInstance) {
                // Default is empty data array
                /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput(sprintf('NODE-DHT-FACADE: locatorInstance=%s - CALLED!', $locatorInstance->__toString()));
-               //* DEBUG-DIE: */ die(sprintf('[%s:%d]: locatorInstance=%s', __METHOD__, __LINE__, print_r($locatorInstance, TRUE)));
+               //* DEBUG-DIE: */ ApplicationEntryPoint::exitApplication(sprintf('[%s:%d]: locatorInstance=%s', __METHOD__, __LINE__, print_r($locatorInstance, TRUE)));
                $nodeData = [];
 
                // Query database
                $resultInstance = $this->getFrontendInstance()->findNodeLocalByLocatorInstance($locatorInstance);
 
                // Make sure the result instance is valid
-               //* DEBUG-DIE: */ die(sprintf('[%s:%d]: resultInstance=%s', __METHOD__, __LINE__, print_r($resultInstance, TRUE)));
+               //* DEBUG-DIE: */ ApplicationEntryPoint::exitApplication(sprintf('[%s:%d]: resultInstance=%s', __METHOD__, __LINE__, print_r($resultInstance, TRUE)));
                assert($resultInstance instanceof SearchableResult);
 
                // Is the next entry valid?
@@ -233,7 +234,7 @@ class NodeDhtFacade extends BaseDht implements DistributableNode, Registerable {
                }
 
                // Return node data
-               //* DEBUG-DIE: */ die(sprintf('[%s:%d]: nodeData=%s', __METHOD__, __LINE__, print_r($nodeData, TRUE)));
+               //* DEBUG-DIE: */ ApplicationEntryPoint::exitApplication(sprintf('[%s:%d]: nodeData=%s', __METHOD__, __LINE__, print_r($nodeData, TRUE)));
                /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput(sprintf('NODE-DHT-FACADE: nodeData()=%d - EXIT!', count($nodeData)));
                return $nodeData;
        }
index 6ae12306a0d98129edb7e33736cb50aebd5bd3fc..3e993829d75e0f1ea037543f83a655be8da802df 100644 (file)
@@ -11,6 +11,7 @@ use Org\Shipsimu\Hub\Node\Data\InvalidSessionIdException;
 use Org\Shipsimu\Hub\Tools\HubTools;
 
 // Import framework stuff
+use Org\Mxchange\CoreFramework\EntryPoint\ApplicationEntryPoint;
 use Org\Mxchange\CoreFramework\Factory\ObjectFactory;
 use Org\Mxchange\CoreFramework\Generic\FrameworkException;
 use Org\Mxchange\CoreFramework\Registry\Registerable;
@@ -124,7 +125,7 @@ class PackageRecipientDiscovery extends BaseRecipientDiscovery implements Discov
                }
 
                // Get a protocol handler back from decoded data
-               //* DEBUG-DIE: */ die(sprintf('[%s:%d]: packageInstance=%s', __METHOD__, __LINE__, print_r($packageInstance, TRUE)));
+               //* DEBUG-DIE: */ ApplicationEntryPoint::exitApplication(sprintf('[%s:%d]: packageInstance=%s', __METHOD__, __LINE__, print_r($packageInstance, TRUE)));
                $handlerInstance = ProtocolHandlerFactory::createProtocolHandlerFromPackageInstance($packageInstance);
 
                // Is the 'recipient' field same as this peer's IP?
index cbe224401b6ef4cc60a8251a98cdf1099bac9972..f72c639dba7d0689b9ffcbb87509dd1dc093626c 100644 (file)
@@ -12,6 +12,7 @@ use Org\Shipsimu\Hub\Pool\Poolable;
 
 // Import framework stuff
 use Org\Mxchange\CoreFramework\Bootstrap\FrameworkBootstrap;
+use Org\Mxchange\CoreFramework\EntryPoint\ApplicationEntryPoint;
 use Org\Mxchange\CoreFramework\Factory\ObjectFactory;
 use Org\Mxchange\CoreFramework\Registry\GenericRegistry;
 use Org\Mxchange\CoreFramework\Socket\InvalidSocketException;
@@ -65,7 +66,7 @@ class SocketFactory extends ObjectFactory {
        public static function createSocketFromPackageInstance (DeliverablePackage $packageInstance, HandleableProtocol $protocolInstance) {
                // Init instance
                /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput(sprintf('SOCKET-FACTORY: packageInstance=%s,protocolInstance=%s - CALLED!', $packageInstance->__toString(), $protocolInstance->__toString()));
-               //* DEBUG-DIE: */ die(sprintf('[%s:%d]: packageInstance=%s', __METHOD__, __LINE__, print_r($packageInstance, TRUE)));
+               //* DEBUG-DIE: */ ApplicationEntryPoint::exitApplication(sprintf('[%s:%d]: packageInstance=%s', __METHOD__, __LINE__, print_r($packageInstance, TRUE)));
                $socketInstance = NULL;
 
                // Construct registry key
index 0468445c7912eedf554b83170965d1f99bb20905..a23f91294b15cea6bd932360344131b45804cbde 100644 (file)
@@ -9,6 +9,7 @@ use Org\Shipsimu\Hub\Network\Package\Delivery\Fragment\PackageFragmenter;
 
 // Import framework stuff
 use Org\Mxchange\CoreFramework\Assertion\AssertionException;
+use Org\Mxchange\CoreFramework\EntryPoint\ApplicationEntryPoint;
 use Org\Mxchange\CoreFramework\Factory\ObjectFactory;
 use Org\Mxchange\CoreFramework\Registry\Registerable;
 use Org\Mxchange\CoreFramework\Utils\String\StringUtils;
@@ -296,7 +297,7 @@ class ChunkHandler extends BaseHubHandler implements HandleableChunks, Registera
        private function preparePackageAssmble () {
                // Make sure both arrays have same count (this however should always be TRUE)
                /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('CHUNK-HANDLER: CALLED!');
-               //* DEBUG-DIE: */ die(sprintf('[%s:%d]: finalPackageChunks=%s', __METHOD__, __LINE__, print_r($this->finalPackageChunks['content'], TRUE)));
+               //* DEBUG-DIE: */ ApplicationEntryPoint::exitApplication(sprintf('[%s:%d]: finalPackageChunks=%s', __METHOD__, __LINE__, print_r($this->finalPackageChunks['content'], TRUE)));
                assert(count($this->finalPackageChunks['hashes']) == count($this->finalPackageChunks['content']));
 
                /*
index 8e6115393237c580d899fd1def93c49b99dc56ad..cc8ed5ccc182d7345ffafb01a495495bd4cce6e7 100644 (file)
@@ -32,6 +32,7 @@ use Org\Shipsimu\Hub\Tools\HubTools;
 
 // Import framework stuff
 use Org\Mxchange\CoreFramework\Compressor\Compressor;
+use Org\Mxchange\CoreFramework\EntryPoint\ApplicationEntryPoint;
 use Org\Mxchange\CoreFramework\Factory\ObjectFactory;
 use Org\Mxchange\CoreFramework\Factory\Registry\Socket\SocketRegistryFactory;
 use Org\Mxchange\CoreFramework\Feature\FrameworkFeature;
@@ -125,17 +126,18 @@ class NetworkPackageHandler extends BaseHubHandler implements Deliverable, Recei
         * Array indexes for raw package array
         */
        const INDEX_PACKAGE_SENDER_ADDRESS   = 0;
-       const INDEX_PACKAGE_SENDER_PORT      = 1;
-       const INDEX_PACKAGE_RECIPIENT        = 2;
-       const INDEX_PACKAGE_CONTENT          = 3;
-       const INDEX_PACKAGE_STATUS           = 4;
-       const INDEX_PACKAGE_HASH             = 5;
-       const INDEX_PACKAGE_PRIVATE_KEY_HASH = 6;
+       const INDEX_PACKAGE_SENDER_ID        = 1;
+       const INDEX_PACKAGE_SENDER_PORT      = 2;
+       const INDEX_PACKAGE_RECIPIENT        = 3;
+       const INDEX_PACKAGE_CONTENT          = 4;
+       const INDEX_PACKAGE_STATUS           = 5;
+       const INDEX_PACKAGE_HASH             = 6;
+       const INDEX_PACKAGE_PRIVATE_KEY_HASH = 7;
 
        /**
         * Size of the decoded data array
         */
-       const DECODED_DATA_ARRAY_SIZE = 7;
+       const DECODED_DATA_ARRAY_SIZE = 8;
 
        /**
         * Named array elements for decoded package content
@@ -259,12 +261,12 @@ class NetworkPackageHandler extends BaseHubHandler implements Deliverable, Recei
        /**
         * Stacker name for new messages
         */
-       const STACKER_NAME_NEW_MESSAGE = 'package_new_message';
+       const STACKER_NAME_NEW_MESSAGE = 'message_new';
 
        /**
         * Stacker name for processed messages
         */
-       const STACKER_NAME_PROCESSED_MESSAGE = 'package_processed_message';
+       const STACKER_NAME_PROCESSED_MESSAGE = 'message_processed';
 
        /**************************************************************************
         *                      Stacker for raw data handling                     *
@@ -452,6 +454,7 @@ class NetworkPackageHandler extends BaseHubHandler implements Deliverable, Recei
                        self::STACKER_NAME_DECODED_HANDLED,
                        self::STACKER_NAME_DECODED_CHUNKED,
                        self::STACKER_NAME_PACKAGE_DECOMPRESSED_XML,
+                       self::STACKER_NAME_NEW_MESSAGE,
                        self::STACKER_NAME_PROCESSED_MESSAGE,
                        self::STACKER_NAME_OUTGOING_STREAM
                ), $forceReInit);
@@ -474,7 +477,7 @@ class NetworkPackageHandler extends BaseHubHandler implements Deliverable, Recei
 
                // Is an entry found?
                /* NOISY-DEBUG */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput(sprintf('NETWORK-PACKAGE-HANDLER: senderData()=%d', count($senderData)));
-               //* DEBUG-DIE: */ die(sprintf('[%s:%d]: senderData=%s', __METHOD__, __LINE__, print_r($senderData, TRUE)));
+               //* DEBUG-DIE: */ ApplicationEntryPoint::exitApplication(sprintf('[%s:%d]: senderData=%s', __METHOD__, __LINE__, print_r($senderData, TRUE)));
                if (count($senderData) > 0 || !empty($senderData[NodeDistributedHashTableDatabaseFrontend::DB_COLUMN_PRIVATE_KEY_HASH])) {
                        // Return it
                        /* NOISY-DEBUG */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput(sprintf('NETWORK-PACKAGE-HANDLER: Returning senderData[%s]=%s', NodeDistributedHashTableDatabaseFrontend::DB_COLUMN_PRIVATE_KEY_HASH, $senderData[NodeDistributedHashTableDatabaseFrontend::DB_COLUMN_PRIVATE_KEY_HASH]));
@@ -576,7 +579,7 @@ class NetworkPackageHandler extends BaseHubHandler implements Deliverable, Recei
        public function getHashFromPackageSessionId (DeliverablePackage $packageInstance) {
                // Is session id set?
                /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput(sprintf('NETWORK-PACKAGE-HANDLER: packageInstance=%s - CALLED!', $packageInstance->__toString()));
-               /* DEBUG-DIE: */ die(sprintf('[%s:%d]: packageInstance=%s', __METHOD__, __LINE__, print_r($packageInstance, TRUE)));
+               /* DEBUG-DIE: */ ApplicationEntryPoint::exitApplication(sprintf('[%s:%d]: packageInstance=%s', __METHOD__, __LINE__, print_r($packageInstance, TRUE)));
                if (empty($packageInstance->getSessionId())) {
                        // Throw exception
                        throw new InvalidArgumentException('packageInstance has no sessionId set.');
@@ -585,7 +588,7 @@ class NetworkPackageHandler extends BaseHubHandler implements Deliverable, Recei
                // Create the hash
                // @TODO md5() is very weak, but it needs to be fast
                $hash = md5(sprintf(self::CONTENT_CHECKSUM_MASK,
-                       $packageInstance->getRawXml(),
+                       $packageInstance->getPackageContent(),
                        $packageInstance->getSessionId(),
                        $packageInstance->getCompressorExtension()
                ));
@@ -800,31 +803,38 @@ class NetworkPackageHandler extends BaseHubHandler implements Deliverable, Recei
        }
 
        /**
-        * Checks whether the hash of given package data is 'valid', here that
+        * Checks whether the hash of given package's raw XML is 'valid', here that
         * means it is the same or not.
         *
         * @param       $packageInstance        An instance of a DeliverablePackage class
         * @return      $isHashValid    Whether the hash is valid
         */
-       private function isPackageHashValid (DeliverablePackage $packageInstance) {
+       private function isPackageContentHashValid (DeliverablePackage $packageInstance) {
                // Is the feature enabled?
                /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput(sprintf('NETWORK-PACKAGE-HANDLER: packageInstance=%s - CALLED!', $packageInstance->__toString()));
                if (!FrameworkFeature::isFeatureAvailable('hubcoin_reward')) {
                        // Feature is not enabled, so hashes are always valid
-                       //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('NETWORK-PACKAGE-HANDLER: Feature "hubcoin_reward" not available, not checking hash. Returning TRUE ...');
+                       /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('NETWORK-PACKAGE-HANDLER: Feature "hubcoin_reward" not available, not checking hash. Returning TRUE ...');
                        return TRUE;
+               } elseif (empty($packageInstance->getSenderId())) {
+                       // Empty sender id
+                       ApplicationEntryPoint::exitApplication(sprintf('[%s:%d]: packageInstance->senderId is empty', __METHOD__, __LINE__));
+               } elseif (empty($packageInstance->getPackageContent())) {
+                       // Empty sender id
+                       ApplicationEntryPoint::exitApplication(sprintf('[%s:%d]: packageInstance->PackageContent is empty', __METHOD__, __LINE__));
                }
 
                // Check validity
                /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput(sprintf('NETWORK-PACKAGE-HANDLER: packageInstance->senderId=%s,packageInstance->packageContent=%s,packageInstance->contentHash=%s', $packageInstance->getSenderId(), $packageInstance->getPackageContent(), $packageInstance->getContentHash()));
-               $isHashValid = FrameworkFeature::callFeature('hubcoin_reward', 'checkHash', array(
+               //* DEBUG-DIE: */ ApplicationEntryPoint::exitApplication(sprintf('[%s:%d]: packageInstance=%s', __METHOD__, __LINE__, print_r($packageInstance, TRUE)));
+               $isHashValid = FrameworkFeature::callFeature('hubcoin_reward', 'checkHash', [
                        sprintf('%s:%s:%s',
                                $packageInstance->getSenderId(),
                                $packageInstance->getPackageContent(),
                                $this->determineSenderPrivateKeyHash($packageInstance)
                        ),
                        $packageInstance->getContentHash(),
-               ));
+               ]);
 
                // Return it
                /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput(sprintf('NETWORK-PACKAGE-HANDLER: isHashValid=%s - EXIT!', intval($isHashValid)));
@@ -1433,7 +1443,7 @@ class NetworkPackageHandler extends BaseHubHandler implements Deliverable, Recei
 
                // Assert on count (should be always 6)
                /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput(sprintf('NETWORK-PACKAGE-HANDLER: decodedArray()=%d', count($decodedArray)));
-               //* DEBUG-DIE: */ die(sprintf('[%s:%d]: decodedArray=%s', __METHOD__, __LINE__, print_r($decodedArray, TRUE)));
+               //* DEBUG-DIE: */ ApplicationEntryPoint::exitApplication(sprintf('[%s:%d]: decodedArray=%s', __METHOD__, __LINE__, print_r($decodedArray, TRUE)));
                if (count($decodedArray) != self::DECODED_DATA_ARRAY_SIZE) {
                        // Count of array elements not expected
                        throw new InvalidArgumentException(sprintf('decodedArray()=%d does not match expected size %d. rawPackageContent=%s',
@@ -1448,6 +1458,7 @@ class NetworkPackageHandler extends BaseHubHandler implements Deliverable, Recei
 
                // Set all data
                $packageInstance->setSenderAddress($decodedArray[self::INDEX_PACKAGE_SENDER_ADDRESS]);
+               $packageInstance->setSenderId($decodedArray[self::INDEX_PACKAGE_SENDER_ID]);
                $packageInstance->setSenderPort($decodedArray[self::INDEX_PACKAGE_SENDER_PORT]);
                $packageInstance->setRecipientId($decodedArray[self::INDEX_PACKAGE_RECIPIENT]);
                $packageInstance->setRecipientType(self::RECIPIENT_TYPE_DIRECT);
@@ -1501,14 +1512,14 @@ class NetworkPackageHandler extends BaseHubHandler implements Deliverable, Recei
                // Copy data to package instance
                $packageInstance->setCompressorExtension($decodedContent[self::INDEX_COMPRESSOR_EXTENSION]);
                // Raw XML, being BASE64-decoded, still compressed
-               $packageInstance->setRawXml(base64_decode($decodedContent[self::INDEX_PACKAGE_DATA]));
+               $packageInstance->setPackageContent(base64_decode($decodedContent[self::INDEX_PACKAGE_DATA]));
                // Tags as an indexed array for "tagging" the message
                $packageInstance->setContentTags(explode(self::PACKAGE_TAGS_SEPARATOR, $decodedContent[self::INDEX_TAGS]));
                // Checksum of the _decoded_ data
                $packageInstance->setContentChecksum($decodedContent[self::INDEX_CHECKSUM]);
 
                // Decompress raw XML stream
-               $packageInstance->setRawXml($this->getCompressorInstance()->decompressStream($packageInstance->getRawXml()));
+               $packageInstance->setPackageContent($this->getCompressorInstance()->decompressStream($packageInstance->getPackageContent()));
 
                // And push it on the next stack
                $this->getStackInstance()->pushNamed(self::STACKER_NAME_PACKAGE_DECOMPRESSED_XML, $packageInstance);
@@ -1525,7 +1536,7 @@ class NetworkPackageHandler extends BaseHubHandler implements Deliverable, Recei
        public function isNewMessageArrived () {
                // Determine if the stack is not empty
                //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('NETWORK-PACKAGE-HANDLER: CALLED!');
-               $hasArrived = (!$this->getStackInstance()->isStackEmpty(self::STACKER_NAME_PACKAGE_DECOMPRESSED_XML));
+               $hasArrived = (!$this->getStackInstance()->isStackEmpty(self::STACKER_NAME_NEW_MESSAGE));
 
                // Return it
                //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput(sprintf('NETWORK-PACKAGE-HANDLER: hasArrived=%d - EXIT!', intval($hasArrived)));
@@ -1568,7 +1579,7 @@ class NetworkPackageHandler extends BaseHubHandler implements Deliverable, Recei
                $messageInstance = $this->getStackInstance()->popNamed(self::STACKER_NAME_NEW_MESSAGE);
 
                // Generate the hash of comparing it
-               /* DEBUG-DIE: */ die(sprintf('[%s:%d]: messageInstance=%s', __METHOD__, __LINE__, print_r($messageInstance, TRUE)));
+               /* DEBUG-DIE: */ ApplicationEntryPoint::exitApplication(sprintf('[%s:%d]: messageInstance=%s', __METHOD__, __LINE__, print_r($messageInstance, TRUE)));
                /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput(sprintf('NETWORK-PACKAGE-HANDLER: messageInstance=%s,senderId=%s,senderPrivateKeyHash=%s', $messageInstance->__toString(), $messageInstance->getSenderId(), $messageInstance->getSenderPrivateKeyHash()));
                if (empty($messageInstance->getSenderId())) {
                        // Invalid $messageInstance
@@ -1576,9 +1587,9 @@ class NetworkPackageHandler extends BaseHubHandler implements Deliverable, Recei
                } elseif (empty($messageInstance->getSenderPrivateKeyHash())) {
                        // This needs fixing
                        throw new InvalidPrivateKeyHashException(array($this, $senderData, 'empty hash in decodedData'), BaseHubSystem::EXCEPTION_INVALID_PRIVATE_KEY_HASH);
-               } elseif (!$this->isPackageHashValid($messageInstance)) {
+               } elseif (!$this->isMessageContentHashValid($messageInstance)) {
                        // Is not valid, so throw an exception here
-                       exit(__METHOD__ . ':INVALID HASH! UNDER CONSTRUCTION!' . PHP_EOL);
+                       ApplicationEntryPoint::exitApplication(__METHOD__ . ':INVALID HASH! UNDER CONSTRUCTION!' . PHP_EOL);
                }
 
                // Now get a filter chain back from factory with given tags array
@@ -1621,7 +1632,7 @@ class NetworkPackageHandler extends BaseHubHandler implements Deliverable, Recei
                $packageInstance = $this->getStackInstance()->popNamed(self::STACKER_NAME_PACKAGE_DECOMPRESSED_XML);
 
                // Generate the hash of comparing it
-               /* DEBUG-DIE: */ die(sprintf('[%s:%d]: packageInstance=%s', __METHOD__, __LINE__, print_r($packageInstance, TRUE)));
+               //* DEBUG-DIE: */ ApplicationEntryPoint::exitApplication(sprintf('[%s:%d]: packageInstance=%s', __METHOD__, __LINE__, print_r($packageInstance, TRUE)));
                /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput(sprintf('NETWORK-PACKAGE-HANDLER: packageInstance=%s,senderId=%s,senderPrivateKeyHash=%s', $packageInstance->__toString(), $packageInstance->getSenderId(), $packageInstance->getSenderPrivateKeyHash()));
                if (empty($packageInstance->getSenderId())) {
                        // Invalid $packageInstance
@@ -1629,13 +1640,13 @@ class NetworkPackageHandler extends BaseHubHandler implements Deliverable, Recei
                } elseif (empty($packageInstance->getSenderPrivateKeyHash())) {
                        // This needs fixing
                        throw new InvalidPrivateKeyHashException(array($this, $senderData, 'empty hash in decodedData'), BaseHubSystem::EXCEPTION_INVALID_PRIVATE_KEY_HASH);
-               } elseif (!$this->isPackageHashValid($packageInstance)) {
+               } elseif (!$this->isPackageContentHashValid($packageInstance)) {
                        // Is not valid, so throw an exception here
-                       exit(__METHOD__ . ':INVALID HASH! UNDER CONSTRUCTION!' . PHP_EOL);
+                       ApplicationEntryPoint::exitApplication(__METHOD__ . ':INVALID HASH! UNDER CONSTRUCTION!' . PHP_EOL);
                }
 
                // Parse package's XML into a message instance
-               /* DEBUG-DIE: */ die(sprintf('[%s:%d]: packageInstance=%s', __METHOD__, __LINE__, print_r($packageInstance, TRUE)));
+               /* DEBUG-DIE: */ ApplicationEntryPoint::exitApplication(sprintf('[%s:%d]: packageInstance=%s', __METHOD__, __LINE__, print_r($packageInstance, TRUE)));
 
                // Trace message
                /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('NETWORK-PACKAGE-HANDLER: EXIT!');
index aaa0e308b13d0f1cc7fe49ae9102ee38dc8c554a..0c0f1845de43f5cbb047e50b4774aa6f4cd8f2b4 100644 (file)
@@ -12,6 +12,7 @@ use Org\Shipsimu\Hub\Locator\Node\LocateableNode;
 use Org\Shipsimu\Hub\Traits\Container\Socket\StorableSocketTrait;
 
 // Import framework stuff
+use Org\Mxchange\CoreFramework\EntryPoint\ApplicationEntryPoint;
 use Org\Mxchange\CoreFramework\Registry\Registerable;
 use Org\Mxchange\CoreFramework\Socket\InvalidSocketException;
 
@@ -239,7 +240,7 @@ class ConnectionInfo extends BaseInfo implements ShareableInfo, Registerable {
 
                // Set socket here
                /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput(sprintf('CONNECTION-INFO: Setting socketInstance=%s ...', $socketInstance->__toString()));
-               //* DEBUG-DIE: */ die(sprintf('[%s:%d]: socketInstance=%s', __METHOD__, __LINE__, print_r($socketInstance, TRUE)));
+               //* DEBUG-DIE: */ ApplicationEntryPoint::exitApplication(sprintf('[%s:%d]: socketInstance=%s', __METHOD__, __LINE__, print_r($socketInstance, TRUE)));
                $this->setSocketInstance($socketInstance);
 
                // Trace message
index 765b46814a2f3280373e267b5a07d51c35e1152e..fe2cfc915e42bd750511c21e30f071be339834a3 100644 (file)
@@ -23,6 +23,7 @@ use Org\Mxchange\CoreFramework\Criteria\Add\AddableCriteria;
 use Org\Mxchange\CoreFramework\Criteria\Local\LocalSearchCriteria;
 use Org\Mxchange\CoreFramework\Criteria\Storing\StoreableCriteria;
 use Org\Mxchange\CoreFramework\Database\Updateable;
+use Org\Mxchange\CoreFramework\EntryPoint\ApplicationEntryPoint;
 use Org\Mxchange\CoreFramework\Factory\Database\Frontend\DatabaseFrontendFactory;
 use Org\Mxchange\CoreFramework\Factory\ObjectFactory;
 use Org\Mxchange\CoreFramework\Generic\NullPointerException;
@@ -1036,7 +1037,7 @@ abstract class BaseHubNode extends BaseHubSystem implements Updateable, AddableC
                } // END - if
 
                // Debugging:
-               //* DEBUG-DIE: */ die(sprintf('[%s:%d]: nodeData=%s', __METHOD__, __LINE__, print_r($nodeData, TRUE)));
+               //* DEBUG-DIE: */ ApplicationEntryPoint::exitApplication(sprintf('[%s:%d]: nodeData=%s', __METHOD__, __LINE__, print_r($nodeData, TRUE)));
 
                // Return it
                return $nodeData;
index b43f5955f5739973ec5353b6c1317909b0667ada..36bdb76201470c5cc077fc83bcc1a4eda7943cc2 100644 (file)
@@ -6,6 +6,7 @@ namespace Org\Shipsimu\Hub\Network\Package;
 use Org\Shipsimu\Hub\Generic\BaseHubSystem;
 
 // Import framework stuff
+use Org\Mxchange\CoreFramework\EntryPoint\ApplicationEntryPoint;
 use Org\Mxchange\CoreFramework\Registry\Registerable;
 
 // Import SPL stuff
@@ -41,11 +42,6 @@ class PackageData extends BaseHubSystem implements DeliverablePackage, Registera
         */
        private $contentHash;
 
-       /**
-        * Content message
-        */
-       private $rawXml;
-
        /**
         * Content checksum
         */
@@ -329,25 +325,6 @@ class PackageData extends BaseHubSystem implements DeliverablePackage, Registera
                $this->contentTags = $contentTags;
        }
 
-       /**
-        * Getter for content message
-        *
-        * @return      $rawXml Content message
-        */
-       public final function getRawXml () {
-               return $this->rawXml;
-       }
-
-       /**
-        * Setter for content message
-        *
-        * @param       $rawXml Content message
-        * @return      void
-        */
-       public final function setRawXml (string $rawXml) {
-               $this->rawXml = $rawXml;
-       }
-
        /**
         * Getter for content checksum
         *
@@ -463,7 +440,7 @@ class PackageData extends BaseHubSystem implements DeliverablePackage, Registera
                //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput(sprintf('PACKAGE-DATA: properties()=%d', count($properties)));
                foreach ($properties as $propertyInstance) {
                        // Is the declaring class this one?
-                       //* DEBUG-DIE: */ die(sprintf('[%s:%d] propertyInstance=%s', __METHOD__, __LINE__, print_r($propertyInstance)));
+                       //* DEBUG-DIE: */ ApplicationEntryPoint::exitApplication(sprintf('[%s:%d] propertyInstance=%s', __METHOD__, __LINE__, print_r($propertyInstance)));
                        //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput(sprintf('PACKAGE-DATA: propertyInstance->declaringClass->name=%s', $propertyInstance->getDeclaringClass()->getName()));
                        if ($propertyInstance->getDeclaringClass()->getName() !== $this->__toString()) {
                                // No, then skip this one
index acdf7946bc05eed905fe5f3fadf1f7b4aa1f4e3e..c8870b9cfcb846377684abbb003b79090a63876e 100644 (file)
@@ -11,6 +11,7 @@ use Org\Shipsimu\Hub\Network\Package\DeliverablePackage;
 // Import framework stuff
 use Org\Mxchange\CoreFramework\Assertion\AssertionException;
 use Org\Mxchange\CoreFramework\Bootstrap\FrameworkBootstrap;
+use Org\Mxchange\CoreFramework\EntryPoint\ApplicationEntryPoint;
 use Org\Mxchange\CoreFramework\Factory\ObjectFactory;
 use Org\Mxchange\CoreFramework\Registry\Registerable;
 use Org\Mxchange\CoreFramework\Traits\Crypto\CryptoTrait;
@@ -508,10 +509,12 @@ class PackageFragmenter extends BaseHubSystem implements Fragmentable, Registera
                if (!$this->isPackageProcessed($packageInstance)) {
                        // First put it the right way together again, implode on getAllAsArray() won't work!
                        /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('PACKAGE-FRAGMENTER: Package is not processed., getting all raw data ...');
-                       //* DEBUG-DIE: */ die(sprintf('[%s:%d]: packageInstance->allAsArray=%s', __METHOD__, __LINE__, print_r($packageInstance->getAllAsArray(), TRUE)));
-                       $rawData = sprintf('%s%s%d%s%s%s%s%s%s%s%s%s%s',
+                       //* DEBUG-DIE: */ ApplicationEntryPoint::exitApplication(sprintf('[%s:%d]: packageInstance->allAsArray=%s', __METHOD__, __LINE__, print_r($packageInstance->getAllAsArray(), TRUE)));
+                       $rawData = sprintf('%s%s%s%s%d%s%s%s%s%s%s%s%s%s%s',
                                $packageInstance->getSenderAddress(),
                                NetworkPackageHandler::PACKAGE_DATA_SEPARATOR,
+                               $packageInstance->getSenderId(),
+                               NetworkPackageHandler::PACKAGE_DATA_SEPARATOR,
                                $packageInstance->getSenderPort(),
                                NetworkPackageHandler::PACKAGE_DATA_SEPARATOR,
                                $packageInstance->getRecipientId(),
index 026cf496113d1612c425916e0cb6052285cb23e1..bc7781af74c39e726ac3787b61fefa8c6c1f6af1 100644 (file)
@@ -10,6 +10,7 @@ use Org\Shipsimu\Hub\Network\Recipient\BaseRecipient;
 use Org\Shipsimu\Hub\Network\Recipient\Recipient;
 
 // Import framework stuff
+use Org\Mxchange\CoreFramework\EntryPoint\ApplicationEntryPoint;
 use Org\Mxchange\CoreFramework\Factory\ObjectFactory;
 use Org\Mxchange\CoreFramework\Lists\Listable;
 
@@ -93,7 +94,7 @@ class DhtRecipient extends BaseRecipient implements Recipient {
                foreach ($recipients as $recipient) {
                        // These array elements must exist for this loop:
                        //* PRINTR-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput(sprintf('DHT-RECIPIENT: recipient=%s', print_r($recipient, TRUE)));
-                       //* DEBUG-DIE: */ die(sprintf('[%s:%d]: recipient=%s', __METHOD__, __LINE__, print_r($recipient, TRUE)));
+                       //* DEBUG-DIE: */ ApplicationEntryPoint::exitApplication(sprintf('[%s:%d]: recipient=%s', __METHOD__, __LINE__, print_r($recipient, TRUE)));
                        if (empty($recipient[NodeDistributedHashTableDatabaseFrontend::DB_COLUMN_EXTERNAL_ADDRESS])) {
                                // External UNL needs to be set
                                throw new LogicException(sprintf('recipient[%s] is not set', NodeDistributedHashTableDatabaseFrontend::DB_COLUMN_EXTERNAL_ADDRESS));
index 2632e189c8f14e6a9473cba6d9ba1cb2abd03c49..598e305c9595ea9ca891910654fa09da744c2d0c 100644 (file)
@@ -13,6 +13,7 @@ use Org\Shipsimu\Hub\Network\Package\DeliverablePackage;
 use Org\Shipsimu\Hub\Registry\Socket\RegisterableSocket;
 
 // Import framework stuff
+use Org\Mxchange\CoreFramework\EntryPoint\ApplicationEntryPoint;
 use Org\Mxchange\CoreFramework\Factory\ObjectFactory;
 use Org\Mxchange\CoreFramework\Generic\FrameworkInterface;
 use Org\Mxchange\CoreFramework\Registry\BaseRegistry;
@@ -351,18 +352,18 @@ class SocketRegistry extends BaseRegistry implements Register, RegisterableSocke
        public function isIncomingSocketRegistered (Listenable $listenerInstance) {
                // Default is not found
                /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput(sprintf('SOCKET-REGISTRY: listenerInstance=%s (protocol: %s) - CALLED!', $listenerInstance->__toString(), strtoupper($listenerInstance->getProtocolName())));
-               //* DEBUG-DIE: */ die(sprintf('[%s:%d]: this=%s', __METHOD__, __LINE__, print_r($this, TRUE)));
+               //* DEBUG-DIE: */ ApplicationEntryPoint::exitApplication(sprintf('[%s:%d]: this=%s', __METHOD__, __LINE__, print_r($this, TRUE)));
                $isRegistered = FALSE;
 
                // Search listener's socket sub-registry
                $registryInstance = $this->getInstance($listenerInstance->getProtocolName());
-               //* DEBUG-DIE: */ die(sprintf('[%s:%d]: listenerInstance->protocolName=%s,registryInstance=%s', __METHOD__, __LINE__, $listenerInstance->getProtocolName(), print_r($registryInstance, TRUE)));
+               //* DEBUG-DIE: */ ApplicationEntryPoint::exitApplication(sprintf('[%s:%d]: listenerInstance->protocolName=%s,registryInstance=%s', __METHOD__, __LINE__, $listenerInstance->getProtocolName(), print_r($registryInstance, TRUE)));
 
                // Get all sockets from it
                foreach ($registryInstance->getInstanceRegistry() as $instanceKey => $socketInstance) {
                        // Is this socket as requested?
                        /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput(sprintf('SOCKET-REGISTRY: instanceKey=%s,socketInstance=%s,socketType=%s', $instanceKey, $socketInstance->__toString(), $socketInstance->getSocketType()));
-                       //* DEBUG-DIE: */ die(sprintf('[%s:%d]: socketInstance=%s', __METHOD__, __LINE__, print_r($socketInstance, TRUE)));
+                       //* DEBUG-DIE: */ ApplicationEntryPoint::exitApplication(sprintf('[%s:%d]: socketInstance=%s', __METHOD__, __LINE__, print_r($socketInstance, TRUE)));
                        if ($socketInstance->getSocketType() == StorableSocket::CONNECTION_TYPE_INCOMING) {
                                // Is found!
                                $isRegistered = TRUE;
index 3561fe8ba86d815ceb0fac31f55fa28e1159ee1c..ab8cf6a0077eab01ee161c8a03153eedb4df31b3 100644 (file)
@@ -14,6 +14,7 @@ use Org\Shipsimu\Hub\Tag\Tagable;
 use Org\Shipsimu\Hub\Template\Engine\Xml\ObjectRegistry\XmlObjectRegistryTemplateEngine;
 
 // Import framework stuff
+use Org\Mxchange\CoreFramework\EntryPoint\ApplicationEntryPoint;
 use Org\Mxchange\CoreFramework\Factory\Template\XmlTemplateEngineFactory;
 use Org\Mxchange\CoreFramework\Registry\GenericRegistry;
 
@@ -124,7 +125,7 @@ class PackageTags extends BaseTag implements Tagable {
                $contentData = explode(NetworkPackageHandler::PACKAGE_MASK_SEPARATOR, $packageInstance->getPackageContent());
 
                // Get the tags and store them locally
-               //* DEBUG-DIE: */ die(sprintf('[%s:%d]: contentData(%d)=%s', __METHOD__, __LINE__, count($contentData), print_r($contentData, TRUE)));
+               //* DEBUG-DIE: */ ApplicationEntryPoint::exitApplication(sprintf('[%s:%d]: contentData(%d)=%s', __METHOD__, __LINE__, count($contentData), print_r($contentData, TRUE)));
                $this->setTags(explode(NetworkPackageHandler::PACKAGE_TAGS_SEPARATOR, $contentData[NetworkPackageHandler::INDEX_TAGS]));
        }
 
@@ -156,7 +157,7 @@ class PackageTags extends BaseTag implements Tagable {
                         * the entry is invalid.
                         */
                        /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput(sprintf('PACKAGE-TAGS: entry[]=%s', gettype($entry)));
-                       //* DEBUG-DIE: */ die(sprintf('[%s:%d] entry=%s', __METHOD__, __LINE__, print_r($entry, TRUE)));
+                       //* DEBUG-DIE: */ ApplicationEntryPoint::exitApplication(sprintf('[%s:%d] entry=%s', __METHOD__, __LINE__, print_r($entry, TRUE)));
                        if ((!is_array($entry)) || (count($entry) == 0) || (!isset($entry[XmlObjectRegistryTemplateEngine::OBJECT_TYPE_DATA_PROTOCOL])) || (!isset($entry[XmlObjectRegistryTemplateEngine::OBJECT_TYPE_DATA_RECIPIENT_TYPE]))) {
                                // Invalid entry found
                                throw new InvalidTagException(array($this, $tag), self::EXCEPTION_INVALID_TAG);
index bbbbffde3072a2b17c66b3d5b0178a20a462df05..adcfae52cd98dd0982fb0572e04e016684d33abd 100644 (file)
@@ -12,6 +12,7 @@ use Org\Shipsimu\Hub\Node\Data\InvalidSessionIdException;
 
 // Import framework stuff
 use Org\Mxchange\CoreFramework\Bootstrap\FrameworkBootstrap;
+use Org\Mxchange\CoreFramework\EntryPoint\ApplicationEntryPoint;
 use Org\Mxchange\CoreFramework\Factory\ObjectFactory;
 
 // Import SPL stuff
@@ -187,7 +188,7 @@ class HubTools extends BaseHubSystem {
                $recipientData = DhtObjectFactory::createDhtInstance('node')->findNodeByUniversalNodeLocator($locatorInstance);
 
                // Init variable
-               //* DEBUG-DIE: */ die(sprintf('[%s:%d]: recipientData=%s', __METHOD__, __LINE__, print_r($recipientData, TRUE)));
+               //* DEBUG-DIE: */ ApplicationEntryPoint::exitApplication(sprintf('[%s:%d]: recipientData=%s', __METHOD__, __LINE__, print_r($recipientData, TRUE)));
                $sessionId = NULL;
 
                // Is an entry found?
index 4e085b85ae25795c087c5182623bd12e11af5cb3..c7a70585682f5b706fe014c0ba8efcf0f073d47b 100644 (file)
@@ -178,21 +178,6 @@ interface DeliverablePackage extends HubInterface {
         */
        function setContentTags (array $contentTags);
 
-       /**
-        * Getter for content message
-        *
-        * @return      $rawXml Content message
-        */
-       function getRawXml ();
-
-       /**
-        * Setter for content message
-        *
-        * @param       $rawXml Content message
-        * @return      void
-        */
-       function setRawXml (string $rawXml);
-
        /**
         * Getter for content checksum
         *
diff --git a/core b/core
index 57b4b400d2e4a35f92d83270477157df4ee7c2c4..c30da7e118a91b814adb6e997a1e4a39d0f1cba4 160000 (submodule)
--- a/core
+++ b/core
@@ -1 +1 @@
-Subproject commit 57b4b400d2e4a35f92d83270477157df4ee7c2c4
+Subproject commit c30da7e118a91b814adb6e997a1e4a39d0f1cba4