$dataSetInstance->addCriteria(self::DB_COLUMN_PEER_STATE , $stateInstance->getStateName());
// Try to resolve sender's session id
- $senderData = explode(':', HubTools::resolveSessionId($packageData[NetworkPackage::PACKAGE_DATA_SENDER], $packageData[NetworkPackage::PACKAGE_DATA_PROTOCOL]));
+ $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'));
// Try to solve the recipient
try {
// Resolve any session ids; 0 = IP, 1 = Port
- $recipientData = explode(':', HubTools::resolveSessionId($packageData[NetworkPackage::PACKAGE_DATA_RECIPIENT], NetworkPackage::PROTOCOL_TCP));
+ $recipientData = explode(':', HubTools::resolveSessionId($packageData[NetworkPackage::PACKAGE_DATA_RECIPIENT]));
} catch (NoValidHostnameException $e) {
// Debug message
$helperInstance->debugOutput('CONNECTION-HELPER: Failed to resolve ' . $packageData[NetworkPackage::PACKAGE_DATA_RECIPIENT] . ':' . $e->getMessage());
$socketResource = false;
// Temporary resolve recipient field
- $recipientIpArray = explode(':', HubTools::resolveSessionId($packageData[NetworkPackage::PACKAGE_DATA_RECIPIENT], $packageData[NetworkPackage::PACKAGE_DATA_PROTOCOL]));
+ $recipientIpArray = explode(':', HubTools::resolveSessionId($packageData[NetworkPackage::PACKAGE_DATA_RECIPIENT]));
// Make sure it is a valid ip:port array (2 elements)
assert(count($recipientIpArray) == 2);
* is resolveSessionIdByIpPort()
*
* @param $sessionId A valid session id
- * @param $protocol Name of the used protocol: TCP/UDP
* @return $recipient Recipient as ip:port combination
*/
- protected function resolveIpPortBySessionId ($sessionId, $protocol) {
+ protected function resolveIpPortBySessionId ($sessionId) {
// Get a DHT instance
$dhtInstance = DhtObjectFactory::createDhtObjectInstance('node');
// And ask it for ip:port by given session id
- $recipient = $dhtInstance->findNodeBySessionId($sessionId, $protocol);
+ $recipient = $dhtInstance->findNodeBySessionId($sessionId);
die(__METHOD__.':recipient=<pre>'.print_r($recipient, true).'</pre>' . PHP_EOL);
// Is the recipient invalid?
* is resolveIpPortBySessionId().
*
* @param $ipPort Ip:port combination
- * @param $protocol Name of used protocol (TCP/UDP)
* @return $sessionId Valid session id
*/
- public static function resolveSessionIdByIpPort ($ipPort, $protocol) {
+ public static function resolveSessionIdByIpPort ($ipPort) {
// Get a DHT instance
$dhtInstance = DhtObjectFactory::createDhtObjectInstance('node');
// And ask it for session id by given ip:port
- $recipient = $dhtInstance->findNodeByIpPort($ipPort, $protocol);
+ $recipient = $dhtInstance->findNodeByIpPort($ipPort);
die(__METHOD__.':recipient=<pre>'.print_r($recipient, true).'</pre>' . PHP_EOL);
// Return result
$selfInstance->debugOutput('HUB-TOOLS: Using internal session id resolver.');
// Resolve session id into a ip:port combination
- $recipient = $selfInstance->resolveIpPortBySessionId($sessionId, $protocol);
+ $recipient = $selfInstance->resolveIpPortBySessionId($sessionId);
// Debug message
$selfInstance->debugOutput('HUB-TOOLS: session id ' . $sessionId . ' resolved to ' . $recipient);