From: Roland Häder Date: Fri, 1 Feb 2013 23:02:37 +0000 (+0000) Subject: Added empty task for DHT bootstrapping X-Git-Url: https://git.mxchange.org/?a=commitdiff_plain;h=af974961ece00b79f1782cdf98bcb3470ff32c77;p=hub.git Added empty task for DHT bootstrapping --- diff --git a/.gitattributes b/.gitattributes index 2d95c0e4e..aff2770db 100644 --- a/.gitattributes +++ b/.gitattributes @@ -634,6 +634,7 @@ application/hub/main/tasks/node/class_Node svneol=native#text/plain application/hub/main/tasks/node/decoder/.htaccess -text svneol=unset#text/plain application/hub/main/tasks/node/decoder/class_NodePackageDecoderTask.php -text application/hub/main/tasks/node/dht/.htaccess -text svneol=unset#text/plain +application/hub/main/tasks/node/dht/class_NodeDhtBootstrapTask.php svneol=native#text/plain application/hub/main/tasks/node/dht/class_NodeDhtQueryTask.php svneol=native#text/plain application/hub/main/tasks/node/listener/.htaccess -text svneol=unset#text/plain application/hub/main/tasks/node/ping/.htaccess -text svneol=unset#text/plain diff --git a/application/hub/config.php b/application/hub/config.php index 692d38224..2eb64ee7d 100644 --- a/application/hub/config.php +++ b/application/hub/config.php @@ -498,6 +498,9 @@ $cfg->setConfigEntry('node_chunk_assembler_task_class', 'NodeChunkAssemblerTask' // CFG: NODE-PACKAGE-DECODER-TASK-CLASS $cfg->setConfigEntry('node_package_decoder_task_class', 'NodePackageDecoderTask'); +// CFG: NODE-DHT-BOOTSTRAP-TASK-CLASS +$cfg->setConfigEntry('node_dht_bootstrap_task_class', 'NodeDhtInitializationTask'); + // CFG: NODE-DHT-QUERY-TASK-CLASS $cfg->setConfigEntry('node_dht_query_task_class', 'NodeDhtQueryTask'); @@ -546,6 +549,15 @@ $cfg->setConfigEntry('task_chunk_assembler_interval_delay', 50); // CFG: TASK-CHUNK-ASSEMBLER-MAX-RUNS $cfg->setConfigEntry('task_chunk_assembler_max_runs', 0); +// CFG: TASK-DHT-BOOTSTRAP-STATUP-DELAY +$cfg->setConfigEntry('task_dht_bootstrap_startup_delay', 100); + +// CFG: TASK-DHT-BOOTSTRAP-INTERVAL-DELAY +$cfg->setConfigEntry('task_dht_bootstrap_interval_delay', 3600000); // = 1 hour + +// CFG: TASK-DHT-BOOTSTRAP-MAX-RUNS +$cfg->setConfigEntry('task_dht_bootstrap_max_runs', 1); + // CFG: TASK-DHT-QUERY-STATUP-DELAY $cfg->setConfigEntry('task_dht_query_startup_delay', 1400); diff --git a/application/hub/main/filter/task/node/class_NodeTaskHandlerInitializerFilter.php b/application/hub/main/filter/task/node/class_NodeTaskHandlerInitializerFilter.php index 5d17d92da..c28671577 100644 --- a/application/hub/main/filter/task/node/class_NodeTaskHandlerInitializerFilter.php +++ b/application/hub/main/filter/task/node/class_NodeTaskHandlerInitializerFilter.php @@ -91,6 +91,12 @@ class NodeTaskHandlerInitializerFilter extends BaseNodeFilter implements Filtera // Register it as well $handlerInstance->registerTask('package_decoder', $taskInstance); + // Generate DHT initialization task + $taskInstance = ObjectFactory::createObjectByConfiguredName('node_dht_bootstrap_task_class'); + + // Register it as well + $handlerInstance->registerTask('dht_bootstrap', $taskInstance); + // Generate DHT query task $taskInstance = ObjectFactory::createObjectByConfiguredName('node_dht_query_task_class'); diff --git a/application/hub/main/tasks/node/announcement/class_NodeAnnouncementTask.php b/application/hub/main/tasks/node/announcement/class_NodeAnnouncementTask.php index 803f5c71d..2d0e1e3d6 100644 --- a/application/hub/main/tasks/node/announcement/class_NodeAnnouncementTask.php +++ b/application/hub/main/tasks/node/announcement/class_NodeAnnouncementTask.php @@ -50,7 +50,6 @@ class NodeAnnouncementTask extends BaseTask implements Taskable, Visitable { * * @param $visitorInstance An instance of a Visitor class * @return void - * @todo 0% */ public function accept (Visitor $visitorInstance) { // Visit this task diff --git a/application/hub/main/tasks/node/class_Node b/application/hub/main/tasks/node/class_Node index 82b881ed5..154e8f436 100644 --- a/application/hub/main/tasks/node/class_Node +++ b/application/hub/main/tasks/node/class_Node @@ -61,7 +61,7 @@ class Node???Task extends BaseTask implements Taskable, Visitable { * Executes the task * * @return void - * @todo 0% + * @todo 0% done */ public function executeTask () { $this->partialStub('Unimplemented task.'); diff --git a/application/hub/main/tasks/node/dht/class_NodeDhtBootstrapTask.php b/application/hub/main/tasks/node/dht/class_NodeDhtBootstrapTask.php new file mode 100644 index 000000000..25348ba84 --- /dev/null +++ b/application/hub/main/tasks/node/dht/class_NodeDhtBootstrapTask.php @@ -0,0 +1,72 @@ + + * @version 0.0.0 + * @copyright Copyright (c) 2007, 2008 Roland Haeder, 2009 - 2012 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 . + */ +class NodeDhtBootstrapTask extends BaseTask implements Taskable, Visitable { + /** + * Protected constructor + * + * @return void + */ + protected function __construct () { + // Call parent constructor + parent::__construct(__CLASS__); + } + + /** + * Creates an instance of this class + * + * @return $taskInstance An instance of a Visitable class + */ + public final static function createNodeDhtBootstrapTask () { + // Get new instance + $taskInstance = new NodeDhtBootstrapTask(); + + // Return the prepared instance + return $taskInstance; + } + + /** + * Accepts the visitor to process the visit "request" + * + * @param $visitorInstance An instance of a Visitor class + * @return void + * @todo Maybe visit some sub-objects + */ + public function accept (Visitor $visitorInstance) { + // Visit this task + $visitorInstance->visitTask($this); + } + + /** + * Executes the task + * + * @return void + * @todo 0% done + */ + public function executeTask () { + $this->partialStub('Unimplemented task.'); + } +} + +// [EOF] +?> diff --git a/application/hub/main/tasks/node/dht/class_NodeDhtQueryTask.php b/application/hub/main/tasks/node/dht/class_NodeDhtQueryTask.php index 833cbe93a..0281d8663 100644 --- a/application/hub/main/tasks/node/dht/class_NodeDhtQueryTask.php +++ b/application/hub/main/tasks/node/dht/class_NodeDhtQueryTask.php @@ -61,7 +61,7 @@ class NodeDhtQueryTask extends BaseTask implements Taskable, Visitable { * Executes the task * * @return void - * @todo 0% + * @todo 0% done */ public function executeTask () { $this->partialStub('Unimplemented task.'); diff --git a/application/hub/main/tasks/node/self_connect/class_NodeSelfConnectTask.php b/application/hub/main/tasks/node/self_connect/class_NodeSelfConnectTask.php index f1e837cfb..2b7a32976 100644 --- a/application/hub/main/tasks/node/self_connect/class_NodeSelfConnectTask.php +++ b/application/hub/main/tasks/node/self_connect/class_NodeSelfConnectTask.php @@ -50,7 +50,6 @@ class NodeSelfConnectTask extends BaseTask implements Taskable, Visitable { * * @param $visitorInstance An instance of a Visitor class * @return void - * @todo 0% */ public function accept (Visitor $visitorInstance) { // Visit this task