]> git.mxchange.org Git - hub.git/commitdiff
Protocol is no longer required for these methods
authorRoland Häder <roland@mxchange.org>
Thu, 7 Feb 2013 23:55:23 +0000 (23:55 +0000)
committerRoland Häder <roland@mxchange.org>
Thu, 7 Feb 2013 23:55:23 +0000 (23:55 +0000)
application/hub/main/database/wrapper/states/class_PeerStateLookupDatabaseWrapper.php
application/hub/main/discovery/package/class_PackageRecipientDiscovery.php
application/hub/main/helper/connection/tcp/class_TcpConnectionHelper.php
application/hub/main/pools/peer/class_DefaultPeerPool.php
application/hub/main/tools/class_HubTools.php

index b8b70fb198c16582c83a2a108db75bb500677540..839fe894da879a27239e9a95da05d6011d532c9d 100644 (file)
@@ -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'));
index 6843d14b5a415ad5402ba64cb8449ff38b1fa78d..6d6c3d490c7ec1766b96cfd085e8523e4b084d1b 100644 (file)
@@ -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);
index 26231956420cb85770b91ebde1f06f340223d525..b6ee583d07f68f800d24126ce80f2a346cb8e19d 100644 (file)
@@ -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());
index 57fd5bd17a97e7edec62cda5623ec4bbab21a0f5..44959858feb2f5247529f109316c12705becd011 100644 (file)
@@ -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);
index e69c4f7dcde1beacc24676c31e68dbbde5323015..413d2fcd3bbeb722b99263a25eb4b241b7f61d68 100644 (file)
@@ -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=<pre>'.print_r($recipient, true).'</pre>' . 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=<pre>'.print_r($recipient, true).'</pre>' . 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);