From bb1787c74697553c7490024e685bb47b11b663b6 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Roland=20H=C3=A4der?= Date: Wed, 8 Jul 2009 21:21:55 +0000 Subject: [PATCH] Rewritten to shortcut method debugOutput() --- application/hub/class_ApplicationHelper.php | 4 ++-- .../main/listener/tcp/class_TcpListener.php | 2 +- .../main/listener/udp/class_UdpListener.php | 2 +- .../hub/main/nodes/boot/class_HubBootNode.php | 10 ++++---- .../hub/main/nodes/class_BaseHubNode.php | 24 +++++++++---------- .../listener/class_DefaultListenerPool.php | 4 ++-- 6 files changed, 23 insertions(+), 23 deletions(-) diff --git a/application/hub/class_ApplicationHelper.php b/application/hub/class_ApplicationHelper.php index 921f04d79..b15862e2d 100644 --- a/application/hub/class_ApplicationHelper.php +++ b/application/hub/class_ApplicationHelper.php @@ -195,9 +195,9 @@ class ApplicationHelper extends BaseFrameworkSystem implements ManageableApplica // Try to bootstrap the node and pass the request instance to it for // extra arguments which mostly override config entries or enable special // features within the hub (none is ready at this development stage) - $this->getDebugInstance()->output('BOOTSTRAP: Beginning with bootstrap...'); + $this->debugOutput('BOOTSTRAP: Beginning with bootstrap...'); $nodeInstance->doBootstrapping(); - $this->getDebugInstance()->output('BOOTSTRAP: Bootstrap finished.'); + $this->debugOutput('BOOTSTRAP: Bootstrap finished.'); // ----------------------- Init all query queues ---------------------- // After the bootstrap is done we need to initialize the queues which diff --git a/application/hub/main/listener/tcp/class_TcpListener.php b/application/hub/main/listener/tcp/class_TcpListener.php index f9fc62142..c48f4d4f5 100644 --- a/application/hub/main/listener/tcp/class_TcpListener.php +++ b/application/hub/main/listener/tcp/class_TcpListener.php @@ -137,7 +137,7 @@ class TcpListener extends BaseListener implements Listenable { $this->setPoolInstance($poolInstance); // Output message - $this->getDebugInstance()->output('LISTENER: TCP listener now ready on IP ' . $this->getListenAddress() . ', port ' . $this->getListenPort() . ' for service.'); + $this->debugOutput('LISTENER: TCP listener now ready on IP ' . $this->getListenAddress() . ', port ' . $this->getListenPort() . ' for service.'); } } diff --git a/application/hub/main/listener/udp/class_UdpListener.php b/application/hub/main/listener/udp/class_UdpListener.php index 9edd449e1..f0d006655 100644 --- a/application/hub/main/listener/udp/class_UdpListener.php +++ b/application/hub/main/listener/udp/class_UdpListener.php @@ -75,7 +75,7 @@ class UdpListener extends BaseListener implements Listenable { $this->setSocketResource($socket); // Output message - $this->getDebugInstance()->output('LISTENER: UDP listener now ready on IP ' . $this->getListenAddress() . ', port ' . $this->getListenPort() . ' for service.'); + $this->debugOutput('LISTENER: UDP listener now ready on IP ' . $this->getListenAddress() . ', port ' . $this->getListenPort() . ' for service.'); } } diff --git a/application/hub/main/nodes/boot/class_HubBootNode.php b/application/hub/main/nodes/boot/class_HubBootNode.php index d27eb90f4..8ffe30886 100644 --- a/application/hub/main/nodes/boot/class_HubBootNode.php +++ b/application/hub/main/nodes/boot/class_HubBootNode.php @@ -72,23 +72,23 @@ class HubBootNode extends BaseHubNode implements NodeHelper { // Is the port the same? if ($bootPort == $ourPort) { // It is the same! - $this->getDebugInstance()->output('BOOTSTRAP: IP/port matches bootstrapping node ' . $this->getBootIpPort() . '.'); + $this->debugOutput('BOOTSTRAP: IP/port matches bootstrapping node ' . $this->getBootIpPort() . '.'); // Now, does the mode match (should be 'boot'!) if ($this->getRequestInstance()->getRequestElement('mode') == 'boot') { // Output debug message - $this->getDebugInstance()->output('BOOTSTRAP: Our node is a valid bootstrapping node.'); + $this->debugOutput('BOOTSTRAP: Our node is a valid bootstrapping node.'); } else { // Output warning - $this->getDebugInstance()->output('BOOTSTRAP: WARNING: Mismatching mode ' . $this->getRequestInstance()->getRequestElement('mode') . '!=boot detected.'); + $this->debugOutput('BOOTSTRAP: WARNING: Mismatching mode ' . $this->getRequestInstance()->getRequestElement('mode') . '!=boot detected.'); } } else { // IP does match, but no port - $this->getDebugInstance()->output('BOOTSTRAP: WARNING: Our IP ' . $_SERVER['SERVER_ADDR'] . ' does match a known bootstrap-node but not the port ' . $ourPort . '/' . $bootPort . '.'); + $this->debugOutput('BOOTSTRAP: WARNING: Our IP ' . $_SERVER['SERVER_ADDR'] . ' does match a known bootstrap-node but not the port ' . $ourPort . '/' . $bootPort . '.'); } } else { // Node does not match any know bootstrap-node - $this->getDebugInstance()->output('BOOTSTRAP: WARNING: Our IP ' . $_SERVER['SERVER_ADDR'] . ' does not match any known bootstrap-nodes.'); + $this->debugOutput('BOOTSTRAP: WARNING: Our IP ' . $_SERVER['SERVER_ADDR'] . ' does not match any known bootstrap-nodes.'); } // This might not be all... diff --git a/application/hub/main/nodes/class_BaseHubNode.php b/application/hub/main/nodes/class_BaseHubNode.php index 2830144ac..08e6fbdd2 100644 --- a/application/hub/main/nodes/class_BaseHubNode.php +++ b/application/hub/main/nodes/class_BaseHubNode.php @@ -101,7 +101,7 @@ class BaseHubNode extends BaseHubSystem implements Updateable { $this->bootIpPort = $ipPort; // Output message - $this->getDebugInstance()->output('BOOTSTRAP: ' . __FUNCTION__ . '[' . __LINE__ . ']: IP matches remote address ' . $ipPort . '.'); + $this->debugOutput('BOOTSTRAP: ' . __FUNCTION__ . '[' . __LINE__ . ']: IP matches remote address ' . $ipPort . '.'); // Stop further searching break; @@ -114,7 +114,7 @@ class BaseHubNode extends BaseHubSystem implements Updateable { $this->bootIpPort = $ipPort; // Output message - $this->getDebugInstance()->output('BOOTSTRAP: ' . __FUNCTION__ . '[' . __LINE__ . ']: IP matches listen address ' . $ipPort . '.'); + $this->debugOutput('BOOTSTRAP: ' . __FUNCTION__ . '[' . __LINE__ . ']: IP matches listen address ' . $ipPort . '.'); // Stop further searching break; @@ -136,14 +136,14 @@ class BaseHubNode extends BaseHubSystem implements Updateable { $app = $this->getApplicationInstance(); // Output all lines - $this->getDebugInstance()->output(' '); - $this->getDebugInstance()->output($app->getAppName() . ' v' . $app->getAppVersion() . ' - ' . $this->getRequestInstance()->getRequestElement('mode') . ' mode active'); - $this->getDebugInstance()->output('Copyright (c) 2007 - 2008 Roland Haeder, 2009 Hub Developer Team'); - $this->getDebugInstance()->output(' '); - $this->getDebugInstance()->output('This program comes with ABSOLUTELY NO WARRANTY; for details see docs/COPYING.'); - $this->getDebugInstance()->output('This is free software, and you are welcome to redistribute it under certain'); - $this->getDebugInstance()->output('conditions; see docs/COPYING for details.'); - $this->getDebugInstance()->output(' '); + $this->debugOutput(' '); + $this->debugOutput($app->getAppName() . ' v' . $app->getAppVersion() . ' - ' . $this->getRequestInstance()->getRequestElement('mode') . ' mode active'); + $this->debugOutput('Copyright (c) 2007 - 2008 Roland Haeder, 2009 Hub Developer Team'); + $this->debugOutput(' '); + $this->debugOutput('This program comes with ABSOLUTELY NO WARRANTY; for details see docs/COPYING.'); + $this->debugOutput('This is free software, and you are welcome to redistribute it under certain'); + $this->debugOutput('conditions; see docs/COPYING for details.'); + $this->debugOutput(' '); } /** @@ -204,7 +204,7 @@ class BaseHubNode extends BaseHubSystem implements Updateable { $this->setNodeId($this->getField(NodeInformationDatabaseWrapper::DB_COLUMN_NODE_ID)); // Output message - $this->getDebugInstance()->output('BOOTSTRAP: Re-using found node-id: ' . $this->getNodeId() . ''); + $this->debugOutput('BOOTSTRAP: Re-using found node-id: ' . $this->getNodeId() . ''); } else { // Get an RNG instance (Random Number Generator) $rngInstance = ObjectFactory::createObjectByConfiguredName('rng_class'); @@ -222,7 +222,7 @@ class BaseHubNode extends BaseHubSystem implements Updateable { $wrapperInstance->registerNodeId($this, $this->getRequestInstance()); // Output message - $this->getDebugInstance()->output('BOOTSTRAP: Created new node-id: ' . $this->getNodeId() . ''); + $this->debugOutput('BOOTSTRAP: Created new node-id: ' . $this->getNodeId() . ''); } } diff --git a/application/hub/main/pools/listener/class_DefaultListenerPool.php b/application/hub/main/pools/listener/class_DefaultListenerPool.php index 1340c8954..c3d28b7f4 100644 --- a/application/hub/main/pools/listener/class_DefaultListenerPool.php +++ b/application/hub/main/pools/listener/class_DefaultListenerPool.php @@ -46,7 +46,7 @@ class DefaultListenerPool extends BasePool implements PoolableListener { $listenerInstance->setNodeInstance($nodeInstance); // This is the last line before the return statement to output some debug output - $listenerInstance->getDebugInstance()->output('POOL: ' . __CLASS__ . ': Initialization finished.'); + $listenerInstance->debugOutput('POOL: ' . __CLASS__ . ': Initialization finished.'); // Return the prepared instance return $listenerInstance; @@ -63,7 +63,7 @@ class DefaultListenerPool extends BasePool implements PoolableListener { parent::addInstance($listenerInstance->getProtocol(), 'listener', $listenerInstance); // Debug message - $this->getDebugInstance()->output( + $this->debugOutput( 'POOL: Listener ' . $listenerInstance->__toString() . ' listening to ' . $listenerInstance->getListenAddress() . ':' . $listenerInstance->getListenPort() . ' added to listener pool.' -- 2.39.5