*/
public function ifUnhandledChunksWithFinalAvailable () {
// Simply check if the stacker is not empty
- /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('CHUNK-HANDLER: CALLED!');
+ //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('CHUNK-HANDLER: CALLED!');
$unhandledChunks = $this->getStackInstance()->isStackEmpty(self::STACKER_NAME_CHUNKS_WITH_FINAL_EOP) === FALSE;
// Return result
- /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput(sprintf('CHUNK-HANDLER: unhandledChunks=%d - EXIT!', intval($unhandledChunks)));
+ //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput(sprintf('CHUNK-HANDLER: unhandledChunks=%d - EXIT!', intval($unhandledChunks)));
return $unhandledChunks;
}
*/
public function ifUnassembledChunksAvailable () {
// For now do only check the array element 'is_complete'
- /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('CHUNK-HANDLER: CALLED!');
+ //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('CHUNK-HANDLER: CALLED!');
$unassembledChunksAvailable = ($this->finalPackageChunks['is_complete'] === TRUE);
// Return status
- /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput(sprintf('CHUNK-HANDLER: unassembledChunksAvailable=%d - EXIT!', intval($unassembledChunksAvailable)));
+ //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput(sprintf('CHUNK-HANDLER: unassembledChunksAvailable=%d - EXIT!', intval($unassembledChunksAvailable)));
return $unassembledChunksAvailable;
}
*/
public function ifRawPackageDataIsAvailable () {
// Check it
- /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('CHUNK-HANDLER: this->rawPackageData()=' . strlen($this->rawPackageData) . ',ifUnassembledChunksAvailable()=' . intval($this->ifUnassembledChunksAvailable()));
+ //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('CHUNK-HANDLER: this->rawPackageData()=' . strlen($this->rawPackageData) . ',ifUnassembledChunksAvailable()=' . intval($this->ifUnassembledChunksAvailable()));
$isRawPackageDataAvailable = ((!empty($this->rawPackageData)) && (!$this->ifUnassembledChunksAvailable()));
// Return it
- /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('CHUNK-HANDLER: isRawPackageDataAvailable=' . intval($isRawPackageDataAvailable));
+ //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('CHUNK-HANDLER: isRawPackageDataAvailable=' . intval($isRawPackageDataAvailable));
return $isRawPackageDataAvailable;
}
} // END - if
// 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(
sprintf('%s:%s:%s',
$packageInstance->getSenderId(),
));
// Return it
- //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('NETWORK-PACKAGE-HANDLER: isHashValid=' . intval($isHashValid) . ' - EXIT!');
+ /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput(sprintf('NETWORK-PACKAGE-HANDLER: isHashValid=%s - EXIT!', intval($isHashValid)));
return $isHashValid;
}
// Package data (aka "message") in BASE64-decoded form but still compressed
$packageInstance->setContentMessage(base64_decode($decodedContent[self::INDEX_PACKAGE_DATA]));
// Tags as an indexed array for "tagging" the message
- $packageInstance->setContentHash(explode(self::PACKAGE_TAGS_SEPARATOR, $decodedContent[self::INDEX_TAGS]));
+ $packageInstance->setContentTags(explode(self::PACKAGE_TAGS_SEPARATOR, $decodedContent[self::INDEX_TAGS]));
// Checksum of the _decoded_ data
$packageInstance->setContentChecksum($decodedContent[self::INDEX_CHECKSUM]);
*/
public function isNewMessageArrived () {
// Determine if the stack is not empty
- /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('NETWORK-PACKAGE-HANDLER: CALLED!');
+ //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('NETWORK-PACKAGE-HANDLER: CALLED!');
$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)));
+ //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput(sprintf('NETWORK-PACKAGE-HANDLER: hasArrived=%d - EXIT!', intval($hasArrived)));
return $hasArrived;
}
*/
public function isProcessedMessagePending () {
// Check it
- /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('NETWORK-PACKAGE-HANDLER: CALLED!');
+ //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('NETWORK-PACKAGE-HANDLER: CALLED!');
$isPending = (!$this->getStackInstance()->isStackEmpty(self::STACKER_NAME_PROCESSED_MESSAGE));
// Return it
- /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput(sprintf('NETWORK-PACKAGE-HANDLER: isPending=%d - EXIT!', intval($isPending)));
+ //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput(sprintf('NETWORK-PACKAGE-HANDLER: isPending=%d - EXIT!', intval($isPending)));
return $isPending;
}
*/
private $contentChecksum;
+ /**
+ * Content tags
+ */
+ private $contentTags;
+
/**
* Package content
*/
$this->contentHash = $contentHash;
}
+ /**
+ * Getter for content tags
+ *
+ * @return $contentTags Content tags
+ */
+ public function getContentTags () {
+ return $this->contentTags;
+ }
+
+ /**
+ * Setter for content tags
+ *
+ * @param $contentTags Content tags
+ * @return void
+ */
+ public function setContentTags (array $contentTags) {
+ $this->contentTags = $contentTags;
+ }
+
/**
* Getter for content message
*
*/
public function executeTask () {
// Get package instance
- /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('NETWORK-PACKAGE-READER-TASK: CALLED!');
+ //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('NETWORK-PACKAGE-READER-TASK: CALLED!');
$handlerInstance = NetworkPackageHandlerFactory::createNetworkPackageHandlerInstance();
// Do we have something to handle?
- /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput(sprintf('NETWORK-PACKAGE-READER-TASK: handlerInstance=%s', $handlerInstance->__toString()));
+ //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput(sprintf('NETWORK-PACKAGE-READER-TASK: handlerInstance=%s', $handlerInstance->__toString()));
if ($handlerInstance->isProcessedMessagePending()) {
/*
* A previously proccessed message is waiting for being
* "interpreted". This is done by trying to find a configuration
* entry based on 'message_type' element.
*/
- /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('NETWORK-PACKAGE-READER-TASK: Calling handlerInstance->handleProcessedMessage() ...');
+ //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('NETWORK-PACKAGE-READER-TASK: Calling handlerInstance->handleProcessedMessage() ...');
$handlerInstance->handleProcessedMessage();
- /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('NETWORK-PACKAGE-READER-TASK: After handlerInstance->handleProcessedMessage() ...');
+ //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('NETWORK-PACKAGE-READER-TASK: After handlerInstance->handleProcessedMessage() ...');
} elseif ($handlerInstance->isNewMessageArrived()) {
/*
* A fully "decoded" message has been received and added for being
* as "XML variables" from the content (which must be a well-formed
* XML) and then pushing it on the next stack "processed messages".
*/
- /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('NETWORK-PACKAGE-READER-TASK: Calling handlerInstance->handleNewlyArrivedMessage() ...');
+ //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('NETWORK-PACKAGE-READER-TASK: Calling handlerInstance->handleNewlyArrivedMessage() ...');
$handlerInstance->handleNewlyArrivedMessage();
- /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('NETWORK-PACKAGE-READER-TASK: After handlerInstance->handleNewlyArrivedMessage() ...');
+ //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('NETWORK-PACKAGE-READER-TASK: After handlerInstance->handleNewlyArrivedMessage() ...');
} elseif ($handlerInstance->isIncomingRawDataHandled()) {
/*
* Incoming decoded data has been handled (see below) so it needs to
* PackageData for further details (what array elements are
* required et cetera).
*/
- /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('NETWORK-PACKAGE-READER-TASK: Calling handlerInstance->assembleDecodedDataToPackage() ...');
+ //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('NETWORK-PACKAGE-READER-TASK: Calling handlerInstance->assembleDecodedDataToPackage() ...');
$handlerInstance->assembleDecodedDataToPackage();
- /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('NETWORK-PACKAGE-READER-TASK: After handlerInstance->assembleDecodedDataToPackage() ...');
+ //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('NETWORK-PACKAGE-READER-TASK: After handlerInstance->assembleDecodedDataToPackage() ...');
} elseif ($handlerInstance->ifMultipleMessagesPending()) {
/*
* Some raw data contained multiple messages which where now
* splitted.
*/
- /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('NETWORK-PACKAGE-READER-TASK: Calling handlerInstance->handleMultipleMessages() ...');
+ //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('NETWORK-PACKAGE-READER-TASK: Calling handlerInstance->handleMultipleMessages() ...');
$handlerInstance->handleMultipleMessages();
- /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('NETWORK-PACKAGE-READER-TASK: After handlerInstance->handleMultipleMessages() ...');
+ //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('NETWORK-PACKAGE-READER-TASK: After handlerInstance->handleMultipleMessages() ...');
} elseif ($handlerInstance->isNewRawDataPending()) {
// Raw, decoded data has been received
- /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('NETWORK-PACKAGE-READER-TASK: Calling handlerInstance->handleIncomingDecodedData() ...');
+ //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('NETWORK-PACKAGE-READER-TASK: Calling handlerInstance->handleIncomingDecodedData() ...');
$handlerInstance->handleIncomingDecodedData();
- /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('NETWORK-PACKAGE-READER-TASK: After handlerInstance->handleIncomingDecodedData() ...');
+ //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('NETWORK-PACKAGE-READER-TASK: After handlerInstance->handleIncomingDecodedData() ...');
} elseif ($handlerInstance->ifAssemblerHasPendingDataLeft()) {
// Handle any pending data from the package assembler
- /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('NETWORK-PACKAGE-READER-TASK: Calling handlerInstance->handleAssemblerPendingData() ...');
+ //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('NETWORK-PACKAGE-READER-TASK: Calling handlerInstance->handleAssemblerPendingData() ...');
$handlerInstance->handleAssemblerPendingData();
- /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('NETWORK-PACKAGE-READER-TASK: After handlerInstance->handleAssemblerPendingData() ...');
+ //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('NETWORK-PACKAGE-READER-TASK: After handlerInstance->handleAssemblerPendingData() ...');
}
// Trace message
- /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('NETWORK-PACKAGE-READER-TASK: EXIT!');
+ //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('NETWORK-PACKAGE-READER-TASK: EXIT!');
}
/**
*/
public static final function createNetworkPackageWriterTask () {
// Get new instance
- /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('NETWORK-PACKAGE-WRITER-TASK: CALLED!');
+ //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('NETWORK-PACKAGE-WRITER-TASK: CALLED!');
$taskInstance = new NetworkPackageWriterTask();
// Return the prepared instance
- /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput(sprintf('NETWORK-PACKAGE-WRITER-TASK: taskInstance=%s - EXIT!', $taskInstance->__toString()));
+ //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput(sprintf('NETWORK-PACKAGE-WRITER-TASK: taskInstance=%s - EXIT!', $taskInstance->__toString()));
return $taskInstance;
}
*/
public function accept (Visitor $visitorInstance) {
// Visit this task
- /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput(sprintf('NETWORK-PACKAGE-WRITER-TASK: visitorInstance=%s - CALLED!', $visitorInstance->__toString()));
+ //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput(sprintf('NETWORK-PACKAGE-WRITER-TASK: visitorInstance=%s - CALLED!', $visitorInstance->__toString()));
$visitorInstance->visitTask($this);
// Trace message
- /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('NETWORK-PACKAGE-WRITER-TASK: EXIT!');
+ //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('NETWORK-PACKAGE-WRITER-TASK: EXIT!');
}
/**
*/
public function executeTask () {
// Get package handler instance
- /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('NETWORK-PACKAGE-WRITER-TASK: CALLED!');
+ //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('NETWORK-PACKAGE-WRITER-TASK: CALLED!');
$handlerInstance = NetworkPackageHandlerFactory::createNetworkPackageHandlerInstance();
// Do we have something to deliver?
- /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput(sprintf('NETWORK-PACKAGE-WRITER-TASK: handlerInstance=%s', $handlerInstance->__toString()));
+ //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput(sprintf('NETWORK-PACKAGE-WRITER-TASK: handlerInstance=%s', $handlerInstance->__toString()));
if ($handlerInstance->isEncodedDataPending()) {
// Sent encoded (raw) data
- /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('NETWORK-PACKAGE-WRITER-TASK: Calling handlerInstance->sendEncodedData() ...');
+ //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('NETWORK-PACKAGE-WRITER-TASK: Calling handlerInstance->sendEncodedData() ...');
$handlerInstance->sendEncodedData();
} elseif ($handlerInstance->isPackageWaitingForDelivery()) {
// Sent it finally out
- /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('NETWORK-PACKAGE-WRITER-TASK: Calling handlerInstance->sendWaitingPackage() ...');
+ //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('NETWORK-PACKAGE-WRITER-TASK: Calling handlerInstance->sendWaitingPackage() ...');
$handlerInstance->sendWaitingPackage();
} elseif ($handlerInstance->isPackageDeclared()) {
// Prepare package for delivery
- /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('NETWORK-PACKAGE-WRITER-TASK: Calling handlerInstance->processDeclaredPackage() ...');
+ //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('NETWORK-PACKAGE-WRITER-TASK: Calling handlerInstance->processDeclaredPackage() ...');
$handlerInstance->processDeclaredPackage();
} elseif ($handlerInstance->isPackageEnqueued()) {
// Okay, then deliver (better discover its recipients) this package
- /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('NETWORK-PACKAGE-WRITER-TASK: Calling handlerInstance->declareEnqueuedPackage() ...');
+ //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('NETWORK-PACKAGE-WRITER-TASK: Calling handlerInstance->declareEnqueuedPackage() ...');
$handlerInstance->declareEnqueuedPackage();
}
// Trace message
- /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('NETWORK-PACKAGE-WRITER-TASK: EXIT!');
+ //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('NETWORK-PACKAGE-WRITER-TASK: EXIT!');
}
/**
*/
public function executeTask () {
// Get a decoder instance
- /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('NODE-PACKAGE-DECODER-TASK: CALLED!');
+ //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('NODE-PACKAGE-DECODER-TASK: CALLED!');
$decoderInstance = DecoderFactory::createPackageDecoderInstance();
// Check if the stacker has some entries left
- /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput(sprintf('NODE-PACKAGE-DECODER-TASK: decoderInstance=%s', $decoderInstance->__toString()));
+ //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput(sprintf('NODE-PACKAGE-DECODER-TASK: decoderInstance=%s', $decoderInstance->__toString()));
if ($decoderInstance->ifDeocedPackagesLeft()) {
// Some decoded packages have arrived (for this node)
- /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('NODE-PACKAGE-DECODER-TASK: Calling decoderInstance->handleDecodedPackage() ...');
+ //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('NODE-PACKAGE-DECODER-TASK: Calling decoderInstance->handleDecodedPackage() ...');
$decoderInstance->handleDecodedPackage();
} elseif ($decoderInstance->ifUnhandledRawPackageDataLeft()) {
// Handle raw data as last option to prevent that the stack runs full
- /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('NODE-PACKAGE-DECODER-TASK: Calling decoderInstance->handleRawPackageData() ...');
+ //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('NODE-PACKAGE-DECODER-TASK: Calling decoderInstance->handleRawPackageData() ...');
$decoderInstance->handleRawPackageData();
}
// Trace message
- /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('NODE-PACKAGE-DECODER-TASK: CALLED!');
+ //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('NODE-PACKAGE-DECODER-TASK: CALLED!');
}
/**
$messageArray[1]->getRecipientUnl(),
$messageArray[1]->getSenderAddress(),
$messageArray[1]->getSenderPort(),
- $messageArray[1]->getHash()
+ $messageArray[1]->getContentHash()
);
// Call parent exception constructor
-Subproject commit 9cd89d14df07b8126300c9535045c779e3fd445c
+Subproject commit cd4ba5256a2b12e69dd95d8d4489f70e1ec5343f