From 8d9a1956c3b9e27e37ba12810b165f41e7643196 Mon Sep 17 00:00:00 2001 From: Roland Haeder Date: Sat, 22 Aug 2015 11:47:18 +0200 Subject: [PATCH] Removed getNodeInstance() and setNodeInstance(). Please now use the following expression to get a node instance: Signed-off-by: Roland Haeder --- ...class_DhtBootstrapNotAcceptedException.php | 2 +- application/hub/main/class_BaseHubSystem.php | 19 ------------------- .../class_NodeMessageDhtBootstrapHandler.php | 11 +---------- .../listener/class_DefaultListenerPool.php | 6 ------ 4 files changed, 2 insertions(+), 36 deletions(-) diff --git a/application/hub/exceptions/dht/class_DhtBootstrapNotAcceptedException.php b/application/hub/exceptions/dht/class_DhtBootstrapNotAcceptedException.php index 33bfea6b8..474d86e2b 100644 --- a/application/hub/exceptions/dht/class_DhtBootstrapNotAcceptedException.php +++ b/application/hub/exceptions/dht/class_DhtBootstrapNotAcceptedException.php @@ -35,7 +35,7 @@ class DhtBootstrapNotAcceptedException extends FrameworkException { $message = sprintf('[%s:%d] This node (%s) is not accepting DHT bootstrap requests, but got one from session-id=%s,unl=%s/%s,status=%s,mode=%s', $messageArray[0]->__toString(), $this->getLine(), - $messageArray[0]->getNodeInstance()->__toString(), + NodeObjectFactory::createNodeInstance()->__toString(), $messageArray[1][XmlDhtBootstrapTemplateEngine::DHT_BOOTSTRAP_DATA_SESSION_ID], $messageArray[1][XmlDhtBootstrapTemplateEngine::DHT_BOOTSTRAP_DATA_EXTERNAL_ADDRESS], $messageArray[1][XmlDhtBootstrapTemplateEngine::DHT_BOOTSTRAP_DATA_INTERNAL_ADDRESS], diff --git a/application/hub/main/class_BaseHubSystem.php b/application/hub/main/class_BaseHubSystem.php index d8b886856..77bf1c345 100644 --- a/application/hub/main/class_BaseHubSystem.php +++ b/application/hub/main/class_BaseHubSystem.php @@ -90,25 +90,6 @@ class BaseHubSystem extends BaseFrameworkSystem { parent::__construct($className); } - /** - * Getter for node instance - * - * @return $nodeInstance An instance of a node node - */ - public final function getNodeInstance () { - return $this->nodeInstance; - } - - /** - * Setter for node instance - * - * @param $nodeInstance An instance of a node node - * @return void - */ - protected final function setNodeInstance (NodeHelper $nodeInstance) { - $this->nodeInstance = $nodeInstance; - } - /** * Setter for network package handler instance * diff --git a/application/hub/main/handler/message-types/dht/class_NodeMessageDhtBootstrapHandler.php b/application/hub/main/handler/message-types/dht/class_NodeMessageDhtBootstrapHandler.php index 8e16c876f..0bf5c5964 100644 --- a/application/hub/main/handler/message-types/dht/class_NodeMessageDhtBootstrapHandler.php +++ b/application/hub/main/handler/message-types/dht/class_NodeMessageDhtBootstrapHandler.php @@ -73,15 +73,6 @@ class NodeMessageDhtBootstrapHandler extends BaseMessageHandler implements Handl // Get new instance $handlerInstance = new NodeMessageDhtBootstrapHandler(); - // Get node instance - $nodeInstance = NodeObjectFactory::createNodeInstance(); - - // Debug message - self::createDebugInstance(__CLASS__)->debugOutput('POOL[' . __METHOD__ . ':' . __LINE__ . ':] Setting node ...'); - - // ... and set it here - $handlerInstance->setNodeInstance($nodeInstance); - // Get a DHT instance $dhtInstance = DhtObjectFactory::createDhtInstance('node'); @@ -102,7 +93,7 @@ class NodeMessageDhtBootstrapHandler extends BaseMessageHandler implements Handl */ public function handleMessageData (array $messageData, Receivable $packageInstance) { // Is this node accepting DHT bootstrap requests? - if (!$this->getNodeInstance()->isAcceptingDhtBootstrap()) { + if (!NodeObjectFactory::createNodeInstance()->isAcceptingDhtBootstrap()) { /* * This node is not accepting DHT bootstrap requests. */ diff --git a/application/hub/main/pools/listener/class_DefaultListenerPool.php b/application/hub/main/pools/listener/class_DefaultListenerPool.php index 3409bd484..5f9cf6e4c 100644 --- a/application/hub/main/pools/listener/class_DefaultListenerPool.php +++ b/application/hub/main/pools/listener/class_DefaultListenerPool.php @@ -42,12 +42,6 @@ class DefaultListenerPool extends BasePool implements PoolableListener { // Get new instance $listenerInstance = new DefaultListenerPool(); - // Debug message - self::createDebugInstance(__CLASS__)->debugOutput('POOL[' . __METHOD__ . ':' . __LINE__ . ':] Setting node ...'); - - // Set the application instance - $listenerInstance->setNodeInstance($nodeInstance); - // Return the prepared instance return $listenerInstance; } -- 2.39.5