// CFG: UDP-CONNECTION-HELPER-CLASS
$cfg->setConfigEntry('udp_connection_helper_class', 'UdpConnectionHelper');
+// CFG: HUB-COMMUNICATION-PROTOCOL-TYPE
+$cfg->setConfigEntry('hub_communication_protocol_type', 'tcp');
+
+// CFG: TCP-PROTOCOL-RESOLVER-CLASS
+$cfg->setConfigEntry('tcp_protocol_resolver_class', 'TcpProtocolResolver');
+
// CFG: TCP-BUFFER-LENGTH
$cfg->setConfigEntry('tcp_buffer_length', 1024);
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
interface DiscoverableUniversalNodeLocator extends Discoverable {
+ /**
+ * "Discovers" an instance of a LocateableNode class for given NodeHelper class
+ *
+ * @param $nodeInstance An instance of a NodeHelper class
+ * @return $unlInstance An instance of a LocateableNode class
+ */
+ function discoverUniversalNodeLocatorByNode (NodeHelper $nodeInstance);
}
// [EOF]
function doSelfConnection (Taskable $taskInstance);
/**
- * Determines the Universal Node Locator
+ * Determines an instance of a LocateableNode class
*
- * @return $unl A an Universal Node Locator for this node
+ * @return $unlInstance An instance of a LocateableNode class for this node
*/
function determineUniversalNodeLocator ();
/**
- * "Getter for an Universal Node Locator array
+ * "Getter for an array of an instance of a LocateableNode class
*
- * @return $unlArray An array an Universal Node Locator for this node
+ * @return $unlArray An array of an instance of a LocateableNode class
*/
function getUniversalNodeLocatorArray ();
--- /dev/null
+Deny from all
--- /dev/null
+<?php
+/**
+ * An interface for node locators (UNL mostly)
+ *
+ * @author Roland Haeder <webmaster@shipsimu.org>
+ * @version 0.0.0
+ * @copyright Copyright (c) 2007, 2008 Roland Haeder, 2009 - 2014 Hub Developer Team
+ * @license GNU GPL 3.0 or any newer version
+ * @link http://www.shipsimu.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/>.
+ */
+interface LocateableNode extends FrameworkInterface {
+}
+
+// [EOF]
+?>
--- /dev/null
+Deny from all
--- /dev/null
+OS<?php
+/**
+ * An interface for ProtocolResolvers
+ *
+ * @author Roland Haeder <webmaster@shipsimu.org>
+ * @version 0.0.0
+ * @copyright Copyright (c) 2007, 2008 Roland Haeder, 2009 - 2014 Hub Developer Team
+ * @license GNU GPL 3.0 or any newer version
+ * @link http://www.shipsimu.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/>.
+ */
+interface ProtocolResolver extends FrameworkInterface {
+}
+
+// [EOF]
+?>
// Return the prepared instance
return $discoveryInstance;
}
+
+ /**
+ * "Discovers" an instance of a LocateableNode class for given NodeHelper class
+ *
+ * @param $nodeInstance An instance of a NodeHelper class
+ * @return $unlInstance An instance of a LocateableNode class
+ */
+ public function discoverUniversalNodeLocatorByNode (NodeHelper $nodeInstance) {
+ /*
+ * First get an instance from the configured hub communication protocol
+ * type (which is mostly TCP, so you get a TcpProtocolResolver here).
+ */
+ $resolverInstance = ProtocolResolverFactory::createResolverFromConfiguredProtocol();
+
+ // Then resolve the node instance into an UNL instance
+ $unlInstance = $resolverInstance->resolveUniversalResourceLocatorFromNodeHelper($nodeInstance);
+ die(__METHOD__ . ':unlInstance=' . print_r($unlInstance, TRUE));
+ }
}
// [EOF]
*/
public function discoverRawRecipients (array $decodedData) {
// This must be available
+ die(__METHOD__ . ': Unfinished' . PHP_EOL);
assert(isset($decodedData[NetworkPackage::PACKAGE_DATA_RECIPIENT]));
// First clear all recipients
--- /dev/null
+Deny from all
--- /dev/null
+<?php
+/**
+ * A factory class for ProtocolResolver
+ *
+ * @author Roland Haeder <webmaster@ship-simu.org>
+ * @version 0.0.0
+ * @copyright Copyright (c) 2007, 2008 Roland Haeder, 2009 - 2014 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 ProtocolResolverFactory extends ObjectFactory {
+ /**
+ * Protected constructor
+ *
+ * @return void
+ */
+ protected function __construct () {
+ // Call parent constructor
+ parent::__construct(__CLASS__);
+ }
+
+ /**
+ * Returns a singleton (registry-based) ProtocolResolver instance
+ *
+ * @return $resolverInstance An instance of a ProtocolResolver class
+ */
+ public static final function createResolverFromConfiguredProtocol () {
+ // Get the configured protocol
+ $protocolName = FrameworkConfiguration::getSelfInstance()->getConfigEntry('hub_communication_protocol_type');
+
+ // If there is no handler?
+ if (Registry::getRegistry()->instanceExists($protocolName . '_protocol_resolver')) {
+ // Get handler from registry
+ $resolverInstance = Registry::getRegistry()->getInstance($protocolName . '_protocol_resolver');
+ } else {
+ // Get the handler instance
+ $resolverInstance = self::createObjectByConfiguredName($protocolName . '_protocol_resolver_class');
+
+ // Add it to the registry
+ Registry::getRegistry()->addInstance($protocolName . '_protocol_resolver', $resolverInstance);
+ }
+
+ // Return the instance
+ return $resolverInstance;
+ }
+}
+
+// [EOF]
+?>
// Call parent constructor
parent::__construct(__CLASS__);
- // Set listener type
+ // Set listener type and protocol name
$this->setListenerType('peer');
+ $this->setProtocolName('tcp');
}
/**
// Call parent constructor
parent::__construct(__CLASS__);
- // Set listener type
+ // Set listener type and protocol name
$this->setListenerType('hub');
+ $this->setProtocolName('tcp');
}
/**
// Call parent constructor
parent::__construct(__CLASS__);
- // Set listener type
+ // Set listener type and protocol name
$this->setListenerType('peer');
+ $this->setProtocolName('udp');
}
/**
// Call parent constructor
parent::__construct(__CLASS__);
- // Set listener type
+ // Set listener type and protocol name
$this->setListenerType('hub');
+ $this->setProtocolName('udp');
}
/**
/**
* Universal node locator of bootstrap node
*/
- private $bootUniversalNodeLocator = '';
+ private $bootUnlInstance = '';
/**
* Whether this node is anncounced (keep on FALSE!)
/**
* Getter for boot IP/port combination
*
- * @return $bootUniversalNodeLocator The IP/port combination of the boot node
+ * @return $bootUnlInstance The IP/port combination of the boot node
*/
protected final function getBootUniversalNodeLocator () {
- return $this->bootUniversalNodeLocator;
+ return $this->bootUnlInstance;
}
/**
$isFound = FALSE;
// Run through all configured IPs
- foreach (explode(BaseHubSystem::BOOTSTRAP_NODES_SEPARATOR, $this->getConfigInstance()->getConfigEntry('hub_bootstrap_nodes')) as $unl) {
- // Get back an array from the UNL
- $unlArray = HubTools::getArrayFromUniversalNodeLocator($unl);
+ foreach (explode(BaseHubSystem::BOOTSTRAP_NODES_SEPARATOR, $this->getConfigInstance()->getConfigEntry('hub_bootstrap_nodes')) as $unlArray) {
// @TODO Unfinished
die(__METHOD__ . ':' . print_r($unlArray, TRUE));
// Found it!
$isFound = TRUE;
- // Remember the port number
- $this->bootUniversalNodeLocator = $unl;
+ // Remember the UNL array
+ $this->bootUnlInstance = $unlArray;
// Output message
- self::createDebugInstance(__CLASS__)->debugOutput('BOOTSTRAP: ' . __FUNCTION__ . '[' . __METHOD__ . ':' . __LINE__ . ']: IP matches remote address ' . $unl . '.');
+ self::createDebugInstance(__CLASS__)->debugOutput('BOOTSTRAP: ' . __FUNCTION__ . '[' . __METHOD__ . ':' . __LINE__ . ']: IP matches remote address ' . $unlArray->__toString() . '.');
// Stop further searching
break;
$isFound = TRUE;
// Remember the port number
- $this->bootUniversalNodeLocator = $unl;
+ $this->bootUnlInstance = $unlArray;
// Output message
- self::createDebugInstance(__CLASS__)->debugOutput('BOOTSTRAP: ' . __FUNCTION__ . '[' . __METHOD__ . ':' . __LINE__ . ']: IP matches listen address ' . $unl . '.');
+ self::createDebugInstance(__CLASS__)->debugOutput('BOOTSTRAP: ' . __FUNCTION__ . '[' . __METHOD__ . ':' . __LINE__ . ']: IP matches listen address ' . $unlArray->__toString() . '.');
// Stop further searching
break;
}
/**
- * Determines the Universal Node Locator
+ * Determines an instance of a LocateableNode class
*
- * @return $unl A an Universal Node Locator for this node
+ * @return $unlInstance An instance of a LocateableNode class for this node
*/
public function determineUniversalNodeLocator () {
// Determine UNL based on this node:
// 1) Get discovery class
$discoveryInstance = ObjectFactory::createObjectByConfiguredName('unl_discovery_class');
- // 1) "Determine it
- $unl = $discoveryInstance->discoverUniversalNodeLocatorByNode($this);
+ // 2) "Determine it
+ $unlInstance = $discoveryInstance->discoverUniversalNodeLocatorByNode($this);
- // Return it
- return $unl;
+ // 3) Return it
+ return $unlInstance;
}
/**
- * "Getter" for Universal Node Locator array
+ * "Getter" for an array of an instance of a LocateableNode class
*
- * @return $unlArray An array of the Universal Node Locator for this node
+ * @return $unlArray An array from an instance of a LocateableNode class for this node
*/
public final function getUniversalNodeLocatorArray () {
- // Get Universal Node Locator (UNL)
- $unl = $this->determineUniversalNodeLocator();
+ // Get the Universal Node Locator (UNL) instance
+ $unlInstance = $this->determineUniversalNodeLocator();
// @TODO Unfinished
- die(__METHOD__ . ':' . print_r($unl, TRUE));
+ die(__METHOD__ . ':unlInstance[' . gettype($unlInstance) . ']=' . print_r($unlInstance, TRUE));
// Return it
return $unlArray;
* @return void
*/
protected final function addInstance ($group, $poolName, Visitable $visitableInstance) {
+ /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__)->debugOutput('POOL[' . __METHOD__ . ':' . __LINE__ . ']: group=' . $group . ',poolName=' . $poolName . ',visitableInstance=' . $visitableInstance->__toString() . ' - CALLED!');
+
+ // Make sure the group is not 'invalid'
+ assert($group != 'invalid');
+
// Is the pool group there?
if (!$this->getPoolEntriesInstance()->isGroupSet($group)) {
// Create the missing pool group
$socketResource = FALSE;
// Temporary resolve recipient field
- $recipientIpArray = explode(':', HubTools::resolveSessionId($packageData[NetworkPackage::PACKAGE_DATA_RECIPIENT]));
+ $unlArray = explode(':', HubTools::resolveSessionId($packageData[NetworkPackage::PACKAGE_DATA_RECIPIENT]));
// Make sure it is a valid Universal Node Locator array (3 elements)
- assert(count($recipientIpArray) == 3);
+ assert(count($unlArray) == 3);
// Debug message
- //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__)->debugOutput('POOL[' . __METHOD__ . ':' . __LINE__ . ']: Checking ' . count($this->getAllSockets()) . ' socket(s),recipientIpArray[0]=' . $recipientIpArray[0] . ',recipientIpArray[1]=' . $recipientIpArray[1] . ' ...');
+ //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__)->debugOutput('POOL[' . __METHOD__ . ':' . __LINE__ . ']: Checking ' . count($this->getAllSockets()) . ' socket(s),unlArray[0]=' . $unlArray[0] . ',unlArray[1]=' . $unlArray[1] . ' ...');
// Default is all sockets
$sockets = $this->getAllSockets();
// Get
// If the "peer" IP and recipient is same, use it
- if ($peerIp == $recipientIpArray[0]) {
+ if ($peerIp == $unlArray[0]) {
// IPs match, so take the socket and quit this loop
$socketResource = $socketArray[self::SOCKET_ARRAY_RESOURCE];
foreach ($recipients as $recipient) {
// These array elements must exist for this loop:
// @TODO Unfinished
- die(__METHOD__ . ':' . print_r($recipient, TRUE));
+ die(__METHOD__ . ':recipient=' . print_r($recipient, TRUE));
assert(!empty($recipient[NodeDistributedHashTableDatabaseWrapper::DB_COLUMN_EXTERNAL_IP]));
assert(!empty($recipient[NodeDistributedHashTableDatabaseWrapper::DB_COLUMN_LISTEN_PORT]));
// Try it on all
foreach ($recipients as $recipient) {
// Try to sole a single recipient
- $unl = HubTools::resolveSessionId($recipient);
+ $unlArray = HubTools::resolveSessionId($recipient);
// Add it as recipient
- $listInstance->addEntry('unl', $unl);
+ $listInstance->addEntry('unl', $unlArray);
} // END - foreach
}
}
// Make sure the recipient is valid
//* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__)->debugOutput('SELF-RECIPIENT: recipient=' . $recipient);
// @TODO Unfinished
- die(__METHOD__ . ':' . print_r($this, TRUE));
+ die(__METHOD__ . 'recipient=:' . print_r($recipient, TRUE));
assert($recipient == NetworkPackage::NETWORK_TARGET_SELF);
// Determine own port
assert($recipient == NetworkPackage::NETWORK_TARGET_UPPER);
// Get all bootstrap nodes
- foreach (explode(BaseHubSystem::BOOTSTRAP_NODES_SEPARATOR, $this->getConfigInstance()->getConfigEntry('hub_bootstrap_nodes')) as $unl) {
+ foreach (explode(BaseHubSystem::BOOTSTRAP_NODES_SEPARATOR, $this->getConfigInstance()->getConfigEntry('hub_bootstrap_nodes')) as $unlArray) {
// Is maximum reached?
if ($listInstance->count() == $this->getConfigInstance()->getConfigEntry('package_recipient_max_count')) {
// Debug message
} // END - if
// Debug message
- /* DEBUG: */ self::createDebugInstance(__CLASS__)->debugOutput('RECIPIENT-RESOLVER: Adding node ' . $unl . ' as recipient.');
+ /* DEBUG: */ self::createDebugInstance(__CLASS__)->debugOutput('RECIPIENT-RESOLVER: Adding node ' . print_r($unlArray, TRUE) . ' as recipient.');
// Add the entry
- $listInstance->addEntry('unl', $unl);
+ $listInstance->addEntry('unl', $unlArray);
} // END - foreach
}
}
--- /dev/null
+Deny from all
--- /dev/null
+<?php
+/**
+ * A !!! protocol resolver class
+ *
+ * @author Roland Haeder <webmaster@shipsimu.org>
+ * @version 0.0.0
+ * @copyright Copyright (c) 2007, 2008 Roland Haeder, 2009 - 2014 Hub Developer Team
+ * @license GNU GPL 3.0 or any newer version
+ * @link http://www.shipsimu.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 !!!ProtocolResolver extends BaseProtocolResolver implements ProtocolResolver, Registerable {
+ /**
+ * Protected constructor
+ *
+ * @return void
+ */
+ protected function __construct () {
+ // Call parent constructor
+ parent::__construct(__CLASS__);
+ }
+
+ /**
+ * Creates an instance of a !!! command resolver with a given default command
+ *
+ * @return $resolverInstance The prepared command resolver instance
+ */
+ public static final function create!!!ProtocolResolver () {
+ // Create the new instance
+ $resolverInstance = new !!!ProtocolResolver();
+
+ // Return the prepared instance
+ return $resolverInstance;
+ }
+
+ /**
+ * Returns an command instance for a given request class or null if
+ * it was not found
+ *
+ * @param $nodeInstance An instance of a NodeHelper class
+ * @return $unlInstance An instance of a LocateableNode class
+ * @todo 0% done
+ */
+ public function resolveUniversalResourceLocatorFromNodeHelper (NodeHelper $nodeInstance) {
+ $this->partialStub('Please implement this method.');
+ }
+}
+
+// [EOF]
+?>
--- /dev/null
+<?php
+/**
+ * A generic protocol resolver class
+ *
+ * @author Roland Haeder <webmaster@shipsimu.org>
+ * @version 0.0.0
+ * @copyright Copyright (c) 2007, 2008 Roland Haeder, 2009 - 2014 Hub Developer Team
+ * @license GNU GPL 3.0 or any newer version
+ * @link http://www.shipsimu.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 BaseProtocolResolver extends BaseResolver {
+ /**
+ * Protected constructor
+ *
+ * @param $className Name of the class
+ * @return void
+ */
+ protected function __construct ($className) {
+ // Call parent constructor
+ parent::__construct($className);
+ }
+}
+
+// [EOF]
+?>
--- /dev/null
+Deny from all
--- /dev/null
+<?php
+/**
+ * A TCP protocol resolver class
+ *
+ * @author Roland Haeder <webmaster@shipsimu.org>
+ * @version 0.0.0
+ * @copyright Copyright (c) 2007, 2008 Roland Haeder, 2009 - 2014 Hub Developer Team
+ * @license GNU GPL 3.0 or any newer version
+ * @link http://www.shipsimu.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 TcpProtocolResolver extends BaseProtocolResolver implements ProtocolResolver, Registerable {
+ /**
+ * Protected constructor
+ *
+ * @return void
+ */
+ protected function __construct () {
+ // Call parent constructor
+ parent::__construct(__CLASS__);
+
+ // Set protocol type
+ $this->setProtocolName('tcp');
+ }
+
+ /**
+ * Creates an instance of a Tcp command resolver with a given default command
+ *
+ * @return $resolverInstance The prepared command resolver instance
+ */
+ public static final function createTcpProtocolResolver () {
+ // Create the new instance
+ $resolverInstance = new TcpProtocolResolver();
+
+ // Return the prepared instance
+ return $resolverInstance;
+ }
+
+ /**
+ * Returns an command instance for a given request class or null if
+ * it was not found
+ *
+ * @param $nodeInstance An instance of a NodeHelper class
+ * @return $unlInstance An instance of a LocateableNode class
+ * @todo 0% done
+ */
+ public function resolveUniversalResourceLocatorFromNodeHelper (NodeHelper $nodeInstance) {
+ $this->partialStub('Please implement this method.');
+ }
+}
+
+// [EOF]
+?>
// Now we need to verify every single tag
$this->verifyAllTags();
- // Return it
+ // Return the last (and only) found protocol (e.g. 'tcp' is very usual)
return $this->lastProtocol;
}
}
/**
- * Resolves a session id into an Universal Node Locator. The opposite method
+ * Resolves a session id into an instance of a LocateableNode class. The opposite method
* is resolveSessionIdByUniversalNodeLocator()
*
* @param $sessionId A valid session id
*/
protected function resolveUniversalNodeLocatorBySessionId ($sessionId) {
// Init variable
- $recipientUniversalNodeLocator = 'invalid:invalid';
+ die(__METHOD__ . ': Unfinished' . PHP_EOL);
+ $recipientUniversalNodeLocator = 'invalid://invalid:invalid';
// And ask it for Universal Node Locator by given session id
$recipient = $this->getDhtInstance()->findNodeLocalBySessionId($sessionId);
// Is the session id the same?
if ($nodeInstance->getSessionId() == $sessionId) {
- // Then get the Universal Node Locator from it, assume TCP by default
+ // Then get an instance of a LocateableNode class from it, assume TCP by default
$recipientUniversalNodeLocator = self::determineOwnExternalIp() . ':' . $nodeInstance->getConfigInstance()->getConfigEntry('node_listen_port');
} // END - if
}
* Resolves a Universal Node Locator into a session id. The "opposite" method
* is resolveUniversalNodeLocatorBySessionId().
*
- * @param $unl Universal Node Locator
- * @return $sessionId Valid session id
+ * @param $unlInstance Universal Node Locator
+ * @return $sessionId Valid session id
*/
- public static function resolveSessionIdByUniversalNodeLocator ($unl) {
+ public static function resolveSessionIdByUniversalNodeLocator (LocateableNode $unlInstance) {
// Get an own instance
$selfInstance = self::getSelfInstance();
// And ask it for session id by given Universal Node Locator
- $recipient = $selfInstance->getDhtInstance()->findNodeByUniversalNodeLocator($unl);
- die(__METHOD__.':recipient=<pre>'.print_r($recipient, TRUE).'</pre>' . PHP_EOL);
+ $recipient = $selfInstance->getDhtInstance()->findNodeByUniversalNodeLocator($unlInstance);
+ die(__METHOD__.':recipient='.print_r($recipient, TRUE));
// Return result
return $sessionId;
}
/**
- * Resolves given session id into an Universal Node Locator, if Universal Node Locator is set, it won't be translated
+ * Resolves given session id into an instance of a LocateableNode class, if Universal Node Locator is set, it won't be translated
*
* @param $address Session id or Universal Node Locator
* @return $recipient Recipient as Universal Node Locator
// Debug message
self::createDebugInstance(__CLASS__)->debugOutput('HUB-TOOLS[' . __METHOD__ . ':' . __LINE__ . ']: Using internal session id resolver.');
- // Resolve session id into an Universal Node Locator
+ // Resolve session id into an instance of a LocateableNode class
$recipient = $selfInstance->resolveUniversalNodeLocatorBySessionId($address);
// Debug message
$senderData = explode(':', HubTools::resolveSessionId($packageData[NetworkPackage::PACKAGE_DATA_SENDER]));
// Just make sure that 'invalid:invalid' is not being processed
- assert(($senderData[0] != 'invalid') && ($senderData[1] != 'invalid'));
+ assert(($senderData[0] != 'invalid') && ($senderData[1] != 'invalid') && ($senderData[2] != 'invalid'));
// Add ip address and port
$dataSetInstance->addCriteria(self::DB_COLUMN_PEER_IP , $senderData[0]);
-Subproject commit 1613679bba663e7d92c2194fd14a047770befe2c
+Subproject commit 6339d66e421f4514ec9de8f61d96e38cb34005e6