]> git.mxchange.org Git - hub.git/blob - application/hub/main/nodes/class_BaseHubNode.php
f3a244107719341c8d92ff1ecc039f68c1029aea
[hub.git] / application / hub / main / nodes / class_BaseHubNode.php
1 <?php
2 /**
3  * A general hub node class
4  *
5  * @author              Roland Haeder <webmaster@ship-simu.org>
6  * @version             0.0.0
7  * @copyright   Copyright (c) 2007, 2008 Roland Haeder, 2009 - 2011 Hub Developer Team
8  * @license             GNU GPL 3.0 or any newer version
9  * @link                http://www.ship-simu.org
10  *
11  * This program is free software: you can redistribute it and/or modify
12  * it under the terms of the GNU General Public License as published by
13  * the Free Software Foundation, either version 3 of the License, or
14  * (at your option) any later version.
15  *
16  * This program is distributed in the hope that it will be useful,
17  * but WITHOUT ANY WARRANTY; without even the implied warranty of
18  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
19  * GNU General Public License for more details.
20  *
21  * You should have received a copy of the GNU General Public License
22  * along with this program.  If not, see <http://www.gnu.org/licenses/>.
23  */
24 class BaseHubNode extends BaseHubSystem implements Updateable {
25         /**
26          * Node types
27          */
28         const NODE_TYPE_BOOT    = 'boot';
29         const NODE_TYPE_MASTER  = 'master';
30         const NODE_TYPE_LIST    = 'list';
31         const NODE_TYPE_REGULAR = 'regular';
32
33         // Exception constants
34         const EXCEPTION_HUB_ALREADY_ANNOUNCED = 0xe00;
35
36         /**
37          * IP/port number of bootstrapping node
38          */
39         private $bootIpPort = '';
40
41         /**
42          * Query connector instance
43          */
44         private $queryConnectorInstance = null;
45
46         /**
47          * Queue connector instance
48          */
49         private $queueConnectorInstance = null;
50
51         /**
52          * Listener pool instance
53          */
54         private $listenerPoolInstance = null;
55
56         /**
57          * Wether this node is anncounced (KEEP ON false!)
58          * @deprecated
59          */
60         private $hubIsAnnounced = false;
61
62         /**
63          * Wether this hub is active
64          */
65         private $isActive = false;
66
67         /**
68          * Protected constructor
69          *
70          * @param       $className      Name of the class
71          * @return      void
72          */
73         protected function __construct ($className) {
74                 // Call parent constructor
75                 parent::__construct($className);
76
77                 // Init state which sets the state to 'init'
78                 $this->initState();
79         }
80
81         /**
82          * Initializes the node's state which sets it to 'init'
83          *
84          * @return      void
85          */
86         private function initState() {
87                 // Get the state factory and create the initial state, we don't need
88                 // the state instance here
89                 NodeStateFactory::createNodeStateInstanceByName('init', $this);
90         }
91
92         /**
93          * Setter for node id
94          *
95          * @param       $nodeId         Our new node id
96          * @return      void
97          */
98         private final function setNodeId ($nodeId) {
99                 // Set it config now
100                 $this->getConfigInstance()->setConfigEntry('node_id', (string) $nodeId);
101         }
102
103         /**
104          * Getter for node id
105          *
106          * @return      $nodeId         Current node id
107          */
108         private final function getNodeId () {
109                 // Get it from config
110                 return $this->getConfigInstance()->getConfigEntry('node_id');
111         }
112
113         /**
114          * Setter for listener pool instance
115          *
116          * @param       $listenerPoolInstance   Our new listener pool instance
117          * @return      void
118          */
119         private final function setListenerPoolInstance (PoolableListener $listenerPoolInstance) {
120                 $this->listenerPoolInstance = $listenerPoolInstance;
121         }
122
123         /**
124          * Getter for listener pool instance
125          *
126          * @return      $listenerPoolInstance   Our current listener pool instance
127          */
128         public final function getListenerPoolInstance () {
129                 return $this->listenerPoolInstance;
130         }
131
132         /**
133          * Setter for session id
134          *
135          * @param       $sessionId              Our new session id
136          * @return      void
137          */
138         private final function setSessionId ($sessionId) {
139                 $this->getConfigInstance()->setConfigEntry('session_id', (string) $sessionId);
140         }
141
142         /**
143          * Getter for session id
144          *
145          * @return      $sessionId              Current session id
146          */
147         public final function getSessionId () {
148                 return $this->getConfigInstance()->getConfigEntry('session_id');
149         }
150
151         /**
152          * Setter for query instance
153          *
154          * @param       $connectorInstance              Our new query instance
155          * @return      void
156          */
157         private final function setQueryConnectorInstance (Connectable $connectorInstance) {
158                 $this->queryConnectorInstance = $connectorInstance;
159         }
160
161         /**
162          * Getter for query instance
163          *
164          * @return      $connectorInstance              Our new query instance
165          */
166         public final function getQueryConnectorInstance () {
167                 return $this->queryConnectorInstance;
168         }
169
170         /**
171          * Setter for queue instance
172          *
173          * @param       $connectorInstance              Our new queue instance
174          * @return      void
175          */
176         private final function setQueueConnectorInstance (Connectable $connectorInstance) {
177                 $this->queueConnectorInstance = $connectorInstance;
178         }
179
180         /**
181          * Getter for queue instance
182          *
183          * @return      $connectorInstance              Our new queue instance
184          */
185         public final function getQueueConnectorInstance () {
186                 return $this->queueConnectorInstance;
187         }
188
189         /**
190          * Getter for boot IP/port combination
191          *
192          * @return      $bootIpPort             The IP/port combination of the boot node
193          */
194         protected final function getBootIpPort () {
195                 return $this->bootIpPort;
196         }
197
198         /**
199          * Checks wether the given IP address matches one of the bootstrapping nodes
200          *
201          * @param       $remoteAddr             IP address to checkout against our bootstrapping list
202          * @return      $isFound                Wether the IP is found
203          */
204         protected function ifAddressMatchesBootstrappingNodes ($remoteAddr) {
205                 // By default nothing is found
206                 $isFound = false;
207
208                 // Run through all configured IPs
209                 foreach (explode(',', $this->getConfigInstance()->getConfigEntry('hub_bootstrap_nodes')) as $ipPort) {
210                         // Split it up in IP/port
211                         $ipPortArray = explode(':', $ipPort);
212
213                         // Does it match?
214                         if ($ipPortArray[0] == $remoteAddr) {
215                                 // Found it!
216                                 $isFound = true;
217
218                                 // Remember the port number
219                                 $this->bootIpPort = $ipPort;
220
221                                 // Output message
222                                 $this->debugOutput('BOOTSTRAP: ' . __FUNCTION__ . '[' . __LINE__ . ']: IP matches remote address ' . $ipPort . '.');
223
224                                 // Stop further searching
225                                 break;
226                         } elseif ($ipPortArray[0] == $this->getConfigInstance()->getConfigEntry('node_listen_addr')) {
227                                 // IP matches listen address. At this point we really don't care
228                                 // if we can really listen on that address
229                                 $isFound = true;
230
231                                 // Remember the port number
232                                 $this->bootIpPort = $ipPort;
233
234                                 // Output message
235                                 $this->debugOutput('BOOTSTRAP: ' . __FUNCTION__ . '[' . __LINE__ . ']: IP matches listen address ' . $ipPort . '.');
236
237                                 // Stop further searching
238                                 break;
239                         }
240                 } // END - foreach
241
242                 // Return the result
243                 return $isFound;
244         }
245
246         /**
247          * Outputs the console teaser. This should only be executed on startup or
248          * full restarts. This method generates some space around the teaser.
249          *
250          * @return      void
251          */
252         public function outputConsoleTeaser () {
253                 // Get the app instance (for shortening our code)
254                 $app = $this->getApplicationInstance();
255
256                 // Output all lines
257                 $this->debugOutput(' ');
258                 $this->debugOutput($app->getAppName() . ' v' . $app->getAppVersion() . ' - ' . $this->getRequestInstance()->getRequestElement('mode') . ' mode active');
259                 $this->debugOutput('Copyright (c) 2007 - 2008 Roland Haeder, 2009 - 2011 Hub Developer Team');
260                 $this->debugOutput(' ');
261                 $this->debugOutput('This program comes with ABSOLUTELY NO WARRANTY; for details see docs/COPYING.');
262                 $this->debugOutput('This is free software, and you are welcome to redistribute it under certain');
263                 $this->debugOutput('conditions; see docs/COPYING for details.');
264                 $this->debugOutput(' ');
265         }
266
267         /**
268          * Generic method to acquire a hub-id. On first run this generates a new one
269          * based on many pseudo-random data. On any later run, unless the id
270          * got not removed from database, it will be restored from the database.
271          *
272          * @param       $requestInstance        A Requestable class
273          * @param       $responseInstance       A Responseable class
274          * @return      void
275          */
276         public function bootstrapAcquireNodeId (Requestable $requestInstance, Responseable $responseInstance) {
277                 // Get a wrapper instance
278                 $wrapperInstance = ObjectFactory::createObjectByConfiguredName('node_info_db_wrapper_class');
279
280                 // Now get a search criteria instance
281                 $searchInstance = ObjectFactory::createObjectByConfiguredName('search_criteria_class');
282
283                 // Search for the node number zero which is hard-coded the default
284                 $searchInstance->addCriteria(NodeInformationDatabaseWrapper::DB_COLUMN_NODE_NR, 1);
285                 $searchInstance->addCriteria(NodeInformationDatabaseWrapper::DB_COLUMN_NODE_TYPE, $this->getRequestInstance()->getRequestElement('mode'));
286                 $searchInstance->setLimit(1);
287
288                 // Get a result back
289                 $resultInstance = $wrapperInstance->doSelectByCriteria($searchInstance);
290
291                 // Is it valid?
292                 if ($resultInstance->next()) {
293                         // Save the result instance in this class
294                         $this->setResultInstance($resultInstance);
295
296                         // Get the node id from result and set it
297                         $this->setNodeId($this->getField(NodeInformationDatabaseWrapper::DB_COLUMN_NODE_ID));
298
299                         // Output message
300                         $this->debugOutput('BOOTSTRAP: Re-using found node-id: ' . $this->getNodeId() . '');
301                 } else {
302                         // Get an RNG instance (Random Number Generator)
303                         $rngInstance = ObjectFactory::createObjectByConfiguredName('rng_class');
304
305                         // Generate a pseudo-random string
306                         $randomString = $rngInstance->randomString(255) . ':' . $this->getBootIpPort()  . ':' . $this->getRequestInstance()->getRequestElement('mode');
307
308                         // Get a crypto instance
309                         $cryptoInstance = ObjectFactory::createObjectByConfiguredName('crypto_class');
310
311                         // Hash and encrypt the string so we become a node id (also documented as "hub id")
312                         $this->setNodeId($cryptoInstance->hashString($cryptoInstance->encryptString($randomString)));
313
314                         // Register the node id with our wrapper
315                         $wrapperInstance->registerNodeId($this, $this->getRequestInstance());
316
317                         // Output message
318                         $this->debugOutput('BOOTSTRAP: Created new node-id: ' . $this->getNodeId() . '');
319                 }
320         }
321
322         /**
323          * Generates a session id which will be sent to the other hubs and peers
324          *
325          * @return      void
326          */
327         public function bootstrapGenerateSessionId () {
328                 // Get an RNG instance
329                 $rngInstance = ObjectFactory::createObjectByConfiguredName('rng_class');
330
331                 // Generate a pseudo-random string
332                 $randomString = $rngInstance->randomString(255) . ':' . $this->getBootIpPort() . ':' . $this->getRequestInstance()->getRequestElement('mode');
333
334                 // Get a crypto instance
335                 $cryptoInstance = ObjectFactory::createObjectByConfiguredName('crypto_class');
336
337                 // Hash and encrypt the string so we become a "node id" aka Hub-Id
338                 $this->setSessionId($cryptoInstance->hashString($cryptoInstance->encryptString($randomString)));
339
340                 // Get a wrapper instance
341                 $wrapperInstance = ObjectFactory::createObjectByConfiguredName('node_info_db_wrapper_class');
342
343                 // Register the node id with our wrapper
344                 $wrapperInstance->registerSessionId($this, $this->getRequestInstance());
345
346                 // Output message
347                 $this->debugOutput('BOOTSTRAP: Created new session-id: ' . $this->getSessionId() . '');
348
349                 // Change the state because the node has auired a hub id
350                 $this->getStateInstance()->nodeGeneratedSessionId();
351         }
352
353         /**
354          * Initializes queues which every node needs
355          *
356          * @return      void
357          */
358         protected function initGenericQueues () {
359                 // Debug message
360                 $this->debugOutput('BOOTSTRAP: Initialize queues: START');
361
362                 // Set the query connector instance
363                 $this->setQueryConnectorInstance(ObjectFactory::createObjectByConfiguredName('query_connector_class', array($this)));
364
365                 // Run a test query
366                 $this->getQueryConnectorInstance()->doTestQuery();
367
368                 // Set the queue connector instance
369                 $this->setQueueConnectorInstance(ObjectFactory::createObjectByConfiguredName('queue_connector_class', array($this)));
370
371                 // Run a test queue
372                 $this->getQueueConnectorInstance()->doTestQueue();
373
374                 // Debug message
375                 $this->debugOutput('BOOTSTRAP: Initialize queues: FINISHED');
376         }
377
378         /**
379          * Adds hub data elements to a given dataset instance
380          *
381          * @param       $criteriaInstance       An instance of a storeable criteria
382          * @param       $requestInstance        An instance of a Requestable class
383          * @return      void
384          */
385         public function addElementsToDataSet (StoreableCriteria $criteriaInstance, Requestable $requestInstance) {
386                 // Add node number and type
387                 $criteriaInstance->addCriteria(NodeInformationDatabaseWrapper::DB_COLUMN_NODE_NR, 1);
388                 $criteriaInstance->addCriteria(NodeInformationDatabaseWrapper::DB_COLUMN_NODE_TYPE, $requestInstance->getRequestElement('mode'));
389
390                 // Add the node id
391                 $criteriaInstance->addCriteria(NodeInformationDatabaseWrapper::DB_COLUMN_NODE_ID, $this->getNodeId());
392
393                 // Add the session id if acquired
394                 if ($this->getSessionId() != '') {
395                         $criteriaInstance->addCriteria(NodeInformationDatabaseWrapper::DB_COLUMN_SESSION_ID, $this->getSessionId());
396                 } // END - if
397         }
398
399         /**
400          * Updates a given field with new value
401          *
402          * @param       $fieldName              Field to update
403          * @param       $fieldValue             New value to store
404          * @return      void
405          * @throws      DatabaseUpdateSupportException  If this class does not support database updates
406          * @todo        Try to make this method more generic so we can move it in BaseFrameworkSystem
407          */
408         public function updateDatabaseField ($fieldName, $fieldValue) {
409                 // Unfinished
410                 $this->partialStub('Unfinished!');
411                 return;
412
413                 // Get a critieria instance
414                 $searchInstance = ObjectFactory::createObjectByConfiguredName('search_criteria_class');
415
416                 // Add search criteria
417                 $searchInstance->addCriteria(UserDatabaseWrapper::DB_COLUMN_USERNAME, $this->getUserName());
418                 $searchInstance->setLimit(1);
419
420                 // Now get another criteria
421                 $updateInstance = ObjectFactory::createObjectByConfiguredName('update_criteria_class');
422
423                 // Add criteria entry which we shall update
424                 $updateInstance->addCriteria($fieldName, $fieldValue);
425
426                 // Add the search criteria for searching for the right entry
427                 $updateInstance->setSearchInstance($searchInstance);
428
429                 // Set wrapper class name
430                 $updateInstance->setWrapperConfigEntry('user_db_wrapper_class');
431
432                 // Remember the update in database result
433                 $this->getResultInstance()->add2UpdateQueue($updateInstance);
434         }
435
436         /**
437          * Announces this hub to the upper (bootstrap or list) hubs. After this is
438          * successfully done the given task is unregistered from the handler. This
439          * might look a bit overloaded here but the announcement phase isn't a
440          * simple "Hello there" message, it may later on also contain more
441          * informations like the object list.
442          *
443          * @param       $taskInstance   The task instance running this announcement
444          * @return      void
445          * @throws      HubAlreadyAnnouncedException    If this hub is already announced
446          * @todo        Change the first if() block to check for a specific state
447          */
448         public function announceSelfToUpperNodes (Taskable $taskInstance) {
449                 // Is this hub node announced?
450                 if ($this->hubIsAnnounced === true) {
451                         // Already announced!
452                         throw new HubAlreadyAnnouncedException($this, self::EXCEPTION_HUB_ALREADY_ANNOUNCED);
453                 } // END - if
454
455                 // Debug output
456                 $this->debugOutput('HUB-Announcement: START (taskInstance=' . $taskInstance->__toString(). ')');
457
458                 // Get a helper instance
459                 $helperInstance = ObjectFactory::createObjectByConfiguredName('hub_announcement_helper_class', array($this));
460
461                 // Load the announcement descriptor
462                 $helperInstance->loadDescriptorXml();
463
464                 // Set some dummy configuration entries, e.g. node_status
465                 $this->getConfigInstance()->setConfigEntry('node_status', $this->getStateInstance()->getStateName());
466
467                 // Compile all variables
468                 $helperInstance->getTemplateInstance()->compileConfigInVariables();
469
470                 // "Publish" the descriptor by sending it to the bootstrap/list nodes
471                 $helperInstance->sendPackage($this);
472
473                 // Change the state, this should be the last line except debug output
474                 $this->getStateInstance()->nodeAnnouncedToUpperHubs();
475
476                 // Debug output
477                 $this->debugOutput('HUB-Announcement: FINISHED');
478         }
479
480         /**
481          * Does a self-connect attempt on the public IP address. This should make
482          * it sure, we are reachable from outside world. For this kind of package we
483          * don't need that overload we have in the announcement phase.
484          *
485          * @param       $taskInstance   The task instance running this announcement
486          * @return      void
487          */
488         public function doSelfConnection (Taskable $taskInstance) {
489                 // Debug output
490                 $this->debugOutput('HUB: Self Connection: START (taskInstance=' . $taskInstance->__toString(). ')');
491
492                 // Get a helper instance
493                 $helperInstance = ObjectFactory::createObjectByConfiguredName('hub_self_connect_helper_class', array($this));
494
495                 // Load the descriptor (XML) file
496                 $helperInstance->loadDescriptorXml();
497
498                 // And send the package away
499                 $helperInstance->sendPackage($this);
500
501                 // Debug output
502                 $this->debugOutput('HUB: Self Connection: FINISHED');
503         }
504
505         /**
506          * Activates the hub by doing some final preparation and setting
507          * $hubIsActive to true
508          *
509          * @param       $requestInstance        A Requestable class
510          * @param       $responseInstance       A Responseable class
511          * @return      void
512          */
513         public function activateNode (Requestable $requestInstance, Responseable $responseInstance) {
514                 // Checks wether a listener is still active and shuts it down if one
515                 // is still listening.
516                 if (($this->determineIfListenerIsActive()) && ($this->getIsActive())) {
517                         // Shutdown them down before they can hurt anything
518                         $this->shutdownListenerPool();
519                 } // END - if
520
521                 // Get the controller here
522                 $controllerInstance = Registry::getRegistry()->getInstance('controller');
523
524                 // Run all filters for the hub activation
525                 $controllerInstance->executeActivationFilters($requestInstance, $responseInstance);
526
527                 // ----------------------- Last step from here ------------------------
528                 // Activate the hub. This is ALWAYS the last step in this method
529                 $this->getStateInstance()->nodeIsActivated();
530                 // ---------------------- Last step until here ------------------------
531         }
532
533         /**
534          * Initializes the listener pool (class)
535          *
536          * @return      void
537          */
538         public function initializeListenerPool () {
539                 // Debug output
540                 $this->debugOutput('HUB: Initialize listener: START');
541
542                 // Get a new pool instance
543                 $this->setListenerPoolInstance(ObjectFactory::createObjectByConfiguredName('listener_pool_class', array($this)));
544
545                 // Get an instance of the low-level listener
546                 $listenerInstance = ObjectFactory::createObjectByConfiguredName('tcp_listener_class', array($this));
547
548                 // Setup address and port
549                 $listenerInstance->setListenAddressByConfiguration('node_listen_addr');
550                 if ($this instanceof HubBootNode) {
551                         // Bootstrap have different listening port
552                         $listenerInstance->setListenPortByConfiguration('boot_node_tcp_listen_port');
553                 } else {
554                         // All other nodes use the default port
555                         $listenerInstance->setListenPortByConfiguration('node_tcp_listen_port');
556                 }
557
558                 // Initialize the listener
559                 $listenerInstance->initListener();
560
561                 // Get a decorator class
562                 $decoratorInstance = ObjectFactory::createObjectByConfiguredName('hub_tcp_listener_class', array($listenerInstance));
563
564                 // Add this listener to the pool
565                 $this->getListenerPoolInstance()->addListener($decoratorInstance);
566
567                 // Get a decorator class
568                 $decoratorInstance = ObjectFactory::createObjectByConfiguredName('peer_tcp_listener_class', array($listenerInstance));
569
570                 // Add this listener to the pool
571                 $this->getListenerPoolInstance()->addListener($decoratorInstance);
572
573                 // Get an instance of the low-level listener
574                 $listenerInstance = ObjectFactory::createObjectByConfiguredName('udp_listener_class', array($this));
575
576                 // Setup address and port
577                 $listenerInstance->setListenAddressByConfiguration('node_listen_addr');
578                 if ($this instanceof HubBootNode) {
579                         // Bootstrap have different listening port
580                         $listenerInstance->setListenPortByConfiguration('boot_node_udp_listen_port');
581                 } else {
582                         // All other nodes use the default port
583                         $listenerInstance->setListenPortByConfiguration('node_udp_listen_port');
584                 }
585
586                 // Initialize the listener
587                 $listenerInstance->initListener();
588
589                 // Get a decorator class
590                 $decoratorInstance = ObjectFactory::createObjectByConfiguredName('hub_udp_listener_class', array($listenerInstance));
591
592                 // Add this listener to the pool
593                 $this->getListenerPoolInstance()->addListener($decoratorInstance);
594
595                 // Get a decorator class
596                 $decoratorInstance = ObjectFactory::createObjectByConfiguredName('peer_udp_listener_class', array($listenerInstance));
597
598                 // Add this listener to the pool
599                 $this->getListenerPoolInstance()->addListener($decoratorInstance);
600
601                 // Debug output
602                 $this->debugOutput('HUB: Initialize listener: FINISHED.');
603         }
604
605         /**
606          * Restores a previously stored node list from database
607          *
608          * @return      void
609          */
610         public function bootstrapRestoreNodeList () {
611                 // Debug output
612                 $this->debugOutput('HUB: Restore node list: START');
613
614                 // Get a wrapper instance
615                 $wrapperInstance = ObjectFactory::createObjectByConfiguredName('node_list_db_wrapper_class');
616
617                 // Now get a search criteria instance
618                 $searchInstance = ObjectFactory::createObjectByConfiguredName('search_criteria_class');
619
620                 // Search for the node number zero which is hard-coded the default
621                 // @TODO Add some criteria, e.g. if the node is active or so
622                 //$searchInstance->addCriteria(NodeListDatabaseWrapper::DB_COLUMN_NODE_NR, 1);
623                 //$searchInstance->addCriteria(NodeListDatabaseWrapper::DB_COLUMN_NODE_TYPE, $this->getRequestInstance()->getRequestElement('mode'));
624                 //$searchInstance->setLimit(1);
625
626                 // Get a result back
627                 $resultInstance = $wrapperInstance->doSelectByCriteria($searchInstance);
628
629                 // Is it valid?
630                 if ($resultInstance->next()) {
631                         $this->partialStub('Do something for restoring the list.');
632                         // Output message
633                         //$this->debugOutput('HUB: ');
634                 } else {
635                         // No previously saved node list found!
636                         $this->debugOutput('HUB: No previously saved node list found. This is fine.');
637                 }
638
639                 // Debug output
640                 $this->debugOutput('HUB: Restore node list: FINISHED.');
641         }
642
643         /**
644          * Getter for isActive attribute
645          *
646          * @return      $isActive       Wether the hub is active
647          */
648         public final function getIsActive () {
649                 return $this->isActive;
650         }
651
652         /**
653          * Enables (default) or disables isActive flag
654          *
655          * @param       $isActive       Wether the hub is active
656          * @return      void
657          */
658         public final function enableIsActive ($isActive = true) {
659                 $this->isActive = (bool) $isActive;
660         }
661
662         /**
663          * "Getter for address:port combination
664          *
665          * @param       $handlerInstance        A valid Networkable instance
666          * @return      $addressPort            A address:port combination for this node
667          */
668         public final function getAddressPort (Networkable $handlerInstance) {
669                 // Construct config entry
670                 $configEntry = 'node_' . $handlerInstance->getHandlerName() . '_listen_port';
671
672                 // Get IP and port
673                 $addressPort = $this->getConfigInstance()->detectServerAddress() . ':' . $this->getConfigInstance()->getConfigEntry($configEntry);
674
675                 // Return it
676                 return $addressPort;
677         }
678 }
679
680 // [EOF]
681 ?>