From: Roland Häder Date: Thu, 7 Feb 2013 23:55:23 +0000 (+0000) Subject: Protocol is no longer required for these methods X-Git-Url: https://git.mxchange.org/?a=commitdiff_plain;h=24d594ea5a76ee280062365143db7b7225074cce;p=hub.git Protocol is no longer required for these methods --- diff --git a/application/hub/main/database/wrapper/states/class_PeerStateLookupDatabaseWrapper.php b/application/hub/main/database/wrapper/states/class_PeerStateLookupDatabaseWrapper.php index b8b70fb19..839fe894d 100644 --- a/application/hub/main/database/wrapper/states/class_PeerStateLookupDatabaseWrapper.php +++ b/application/hub/main/database/wrapper/states/class_PeerStateLookupDatabaseWrapper.php @@ -185,7 +185,7 @@ class PeerStateLookupDatabaseWrapper extends BaseDatabaseWrapper implements Look $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')); diff --git a/application/hub/main/discovery/package/class_PackageRecipientDiscovery.php b/application/hub/main/discovery/package/class_PackageRecipientDiscovery.php index 6843d14b5..6d6c3d490 100644 --- a/application/hub/main/discovery/package/class_PackageRecipientDiscovery.php +++ b/application/hub/main/discovery/package/class_PackageRecipientDiscovery.php @@ -113,7 +113,7 @@ class PackageRecipientDiscovery extends BaseHubDiscovery implements Discoverable // Try it on all foreach ($recipients as $recipient) { // Try to sole a single recipient - $ipPort = HubTools::resolveSessionId($recipient, $packageData[NetworkPackage::PACKAGE_DATA_PROTOCOL]); + $ipPort = HubTools::resolveSessionId($recipient); // Add it as recipient $this->getListInstance()->addEntry('ip_port', $ipPort); diff --git a/application/hub/main/helper/connection/tcp/class_TcpConnectionHelper.php b/application/hub/main/helper/connection/tcp/class_TcpConnectionHelper.php index 262319564..b6ee583d0 100644 --- a/application/hub/main/helper/connection/tcp/class_TcpConnectionHelper.php +++ b/application/hub/main/helper/connection/tcp/class_TcpConnectionHelper.php @@ -90,7 +90,7 @@ class TcpConnectionHelper extends BaseConnectionHelper implements ConnectionHelp // 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()); diff --git a/application/hub/main/pools/peer/class_DefaultPeerPool.php b/application/hub/main/pools/peer/class_DefaultPeerPool.php index 57fd5bd17..44959858f 100644 --- a/application/hub/main/pools/peer/class_DefaultPeerPool.php +++ b/application/hub/main/pools/peer/class_DefaultPeerPool.php @@ -221,7 +221,7 @@ class DefaultPeerPool extends BasePool implements PoolablePeer { $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); diff --git a/application/hub/main/tools/class_HubTools.php b/application/hub/main/tools/class_HubTools.php index e69c4f7dc..413d2fcd3 100644 --- a/application/hub/main/tools/class_HubTools.php +++ b/application/hub/main/tools/class_HubTools.php @@ -84,15 +84,14 @@ class HubTools extends BaseHubSystem { * 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=
'.print_r($recipient, true).'
' . PHP_EOL); // Is the recipient invalid? @@ -116,15 +115,14 @@ class HubTools extends BaseHubSystem { * 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=
'.print_r($recipient, true).'
' . PHP_EOL); // Return result @@ -184,7 +182,7 @@ class HubTools extends BaseHubSystem { $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);