application/hub/main/discovery/socket/.htaccess -text svneol=unset#text/plain
application/hub/main/discovery/socket/class_PackageSocketDiscovery.php svneol=native#text/plain
application/hub/main/factories/.htaccess -text svneol=unset#text/plain
+application/hub/main/factories/chunks/.htaccess -text svneol=unset#text/plain
+application/hub/main/factories/chunks/class_ChunkHandlerFactory.php svneol=native#text/plain
application/hub/main/factories/discovery/.htaccess -text svneol=unset#text/plain
application/hub/main/factories/discovery/class_PackageDiscoveryFactory.php svneol=native#text/plain
application/hub/main/factories/discovery/class_SocketDiscoveryFactory.php svneol=native#text/plain
application/hub/main/filter/task/node/.htaccess svneol=native#text/plain
application/hub/main/filter/task/node/class_NodeTaskHandlerInitializerFilter.php svneol=native#text/plain
application/hub/main/handler/.htaccess -text svneol=unset#text/plain
+application/hub/main/handler/chunks/.htaccess -text svneol=unset#text/plain
+application/hub/main/handler/chunks/class_ChunkHandler.php svneol=native#text/plain
application/hub/main/handler/class_ svneol=native#text/plain
application/hub/main/handler/class_BaseHandler.php svneol=native#text/plain
application/hub/main/handler/network/.htaccess -text svneol=unset#text/plain
// CFG: SOCKET-TIMEOUT-MICROSECONDS
$cfg->setConfigEntry('socket_timeout_microseconds', 0);
+// CFG: CHUNK-HANDLER-CLASS
+$cfg->setConfigEntry('chunk_handler_class', 'ChunkHandler');
+
///////////////////////////////////////////////////////////////////////////////
// Peer states
///////////////////////////////////////////////////////////////////////////////
*/
public function __construct (array $messageArray, $code) {
// Construct the message
- $message = sprintf("[%s:%d] The final chunk %s is not a valid EOP (%s) chunk. Raw content: %s, total chunks: %s",
+ $message = sprintf("[%s:%d] The final chunk %s is not a valid EOP (%s) chunk. Total chunks: %s",
$messageArray[0]->__toString(),
$this->getLine(),
- $messageArray[2][count($messageArray[2]) - 1],
+ $messageArray[1][count($messageArray[2]) - 1],
PackageFragmenter::END_OF_PACKAGE_IDENTIFIER,
- $messageArray[1][BaseRawDataHandler::PACKAGE_DECODED_DATA]
- count($messageArray[2])
+ count($messageArray[1])
);
// Call parent exception constructor
--- /dev/null
+Deny from all
--- /dev/null
+<?php
+/**
+ * A factory class for chunk handler
+ *
+ * @author Roland Haeder <webmaster@ship-simu.org>
+ * @version 0.0.0
+ * @copyright Copyright (c) 2007, 2008 Roland Haeder, 2009 - 2011 Hub Developer Team
+ * @license GNU GPL 3.0 or any newer version
+ * @link http://www.ship-simu.org
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ */
+class ChunkHandlerFactory extends ObjectFactory {
+ /**
+ * Protected constructor
+ *
+ * @return void
+ */
+ protected function __construct () {
+ // Call parent constructor
+ parent::__construct(__CLASS__);
+ }
+
+ /**
+ * Returns a singleton (registry-based) chunk handler instance
+ *
+ * @return $handlerInstance An instance of a chunk handler class
+ */
+ public static final function createChunkHandlerInstance () {
+ // If there is no handler?
+ if (Registry::getRegistry()->instanceExists('chunk_handler')) {
+ // Get handler from registry
+ $handlerInstance = Registry::getRegistry()->getInstance('chunk_handler');
+ } else {
+ // Get the handler instance
+ $handlerInstance = self::createObjectByConfiguredName('chunk_handler_class');
+
+ // Add it to the registry
+ Registry::getRegistry()->addInstance('chunk_handler', $handlerInstance);
+ }
+
+ // Return the instance
+ return $handlerInstance;
+ }
+}
+
+// [EOF]
+?>
--- /dev/null
+Deny from all
--- /dev/null
+<?php
+/**
+ * A Chunk handler
+ *
+ * @author Roland Haeder <webmaster@ship-simu.org>
+ * @version 0.0.0
+ * @copyright Copyright (c) 2007, 2008 Roland Haeder, 2009 - 2011 Hub Developer Team
+ * @license GNU GPL 3.0 or any newer version
+ * @link http://www.ship-simu.org
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ */
+class ChunkHandler extends BaseHandler implements Registerable {
+ /**
+ * Protected constructor
+ *
+ * @return void
+ */
+ protected function __construct () {
+ // Call parent constructor
+ parent::__construct(__CLASS__);
+
+ // Set handler name
+ $this->setHandlerName('chunk');
+ }
+
+ /**
+ * Creates an instance of this class
+ *
+ * @return $handlerInstance An instance of a chunk Handler class
+ */
+ public final static function createChunkHandler () {
+ // Get new instance
+ $handlerInstance = new ChunkHandler();
+
+ // Return the prepared instance
+ return $handlerInstance;
+ }
+
+ /**
+ * Adds all chunks if the last one verifies as a 'final chunk'.
+ *
+ * @param $chunks An array with chunks, the last one should be a 'final'
+ * @return void
+ * @throws FinalChunkVerificationException If the final chunk does not start with 'EOP:'
+ */
+ public function addAllChunksWithFinal (array $chunks) {
+ // Validate final chunk
+ if (substr($chunks[count($chunks) - 1], 0, strlen(PackageFragmenter::END_OF_PACKAGE_IDENTIFIER)) != PackageFragmenter::END_OF_PACKAGE_IDENTIFIER) {
+ // Last chunk is not valid
+ throw new FinalChunkVerificationException(array($this, $chunks), BaseListener::EXCEPTION_FINAL_CHUNK_VERIFICATION);
+ } // END - if
+
+ // Not yet finished
+ $this->partialStub('Not yet implemented.');
+ }
+}
+
+// [EOF]
+?>
// Validate final chunk
if (substr($chunks[count($chunks) - 1], 0, strlen(PackageFragmenter::END_OF_PACKAGE_IDENTIFIER)) != PackageFragmenter::END_OF_PACKAGE_IDENTIFIER) {
// Last chunk is not valid
- throw new FinalChunkVerificationException(array($this, $packageContent, $chunks), BaseListener::EXCEPTION_FINAL_CHUNK_VERIFICATION);
+ throw new FinalChunkVerificationException(array($this, $chunks), BaseListener::EXCEPTION_FINAL_CHUNK_VERIFICATION);
} // END - if
- die('chunks='.print_r($chunks,true));
+ // Now get a chunk handler instance
+ $handlerInstance = ChunkHandlerFactory::createChunkHandlerInstance();
+
+ // Add all chunks because the last final chunk is found
+ $handlerInstance->addAllChunksWithFinal($chunks);
}
}
./application/hub/main/package/class_NetworkPackage.php:222: // @TODO crc32() is very weak, but it needs to be fast
./application/hub/main/package/class_NetworkPackage.php:23: * @todo Needs to add functionality for handling the object's type
./application/hub/main/package/class_NetworkPackage.php:386: // @TODO We may want to do somthing more here?
-./application/hub/main/package/class_NetworkPackage.php:486: // @TODO Add some logging here
-./application/hub/main/package/class_NetworkPackage.php:512: // @TODO Add some logging here
-./application/hub/main/package/class_NetworkPackage.php:616: // @TODO Add some logging here
-./application/hub/main/package/class_NetworkPackage.php:695: // @TODO Add some content here
-./application/hub/main/package/class_NetworkPackage.php:745: * @todo This may be enchanced for outgoing packages?
+./application/hub/main/package/class_NetworkPackage.php:492: // @TODO Add some logging here
+./application/hub/main/package/class_NetworkPackage.php:518: // @TODO Add some logging here
+./application/hub/main/package/class_NetworkPackage.php:622: // @TODO Add some logging here
+./application/hub/main/package/class_NetworkPackage.php:716: // @TODO Add some content here
+./application/hub/main/package/class_NetworkPackage.php:766: * @todo This may be enchanced for outgoing packages?
./application/hub/main/package/fragmenter/class_PackageFragmenter.php:427: * @todo $helperInstance is unused
./application/hub/main/pools/peer/class_DefaultPeerPool.php:160: // @TODO Check for IP
./application/hub/main/producer/cruncher/keys/class_CruncherKeyProducer.php:106: // @TODO Do something with it
./application/hub/main/database/wrapper/class_NodeListDatabaseWrapper.php:2:// @DEPRECATED
./application/hub/main/database/wrapper/class_PeerStateLookupDatabaseWrapper.php:2:// @DEPRECATED
./application/hub/main/database/wrapper/states/class_NodeStateLookupDatabaseWrapper.php:2:// @DEPRECATED
+./application/hub/main/factories/fragmenter/class_FragmenterFactory.php:2:// @DEPRECATED
./application/hub/main/factories/states/class_StateFactory.php:2:// @DEPRECATED
./application/hub/main/filter/activation/class_HubActivationSelfAnnouncementFilter.php:2:// @DEPRECATED
./application/hub/main/filter/bootstrap/class_HubBootstrapAquireHubIdFilter.php:2:// @DEPRECATED
./inc/classes/exceptions/language/class_MissingLanguageHandlerException.php:2:// @DEPRECATED
./inc/classes/exceptions/main/class_ClassNotFoundException.php:2:// @DEPRECATED
./inc/classes/exceptions/main/class_ConfigEntryNotFoundException.php:2:// @DEPRECATED
+./inc/classes/exceptions/main/class_MissingDecimalsThousandsSeperatorException.php:2:// @DEPRECATED
./inc/classes/exceptions/main/class_MissingMethodException.php:14: * @deprecated Please do no longer use this exception
./inc/classes/exceptions/state/class_InvalidStateException.php:2:// @DEPRECATED
./inc/classes/interfaces/helper/class_HelpableLogin.php:2:// @DEPRECATED