]> git.mxchange.org Git - hub.git/commitdiff
Some important improvements:
authorRoland Häder <roland@mxchange.org>
Fri, 27 Apr 2012 20:31:31 +0000 (20:31 +0000)
committerRoland Häder <roland@mxchange.org>
Fri, 27 Apr 2012 20:31:31 +0000 (20:31 +0000)
- The recipient IP must now match with external IP + TCP port (please fix this!)
- ... or the reciepient IP must match with own (internal) IP
- TODOs.txt updated

application/hub/main/discovery/package/class_PackageRecipientDiscovery.php
docs/TODOs.txt

index 6c70284b6c340dac4ab968a18db251e136f7cad6..7ed996ca300864f6f20e68db2b1dc2d22a245941 100644 (file)
@@ -98,6 +98,7 @@ class PackageRecipientDiscovery extends BaseHubDiscovery implements Discoverable
         * @param       $decodedData    Decoded raw package data array
         * @return      void
         * @todo        Add some validation of recipient field, e.g. ip:port is found
+        * @todo        The if() does only check for TCP, not UDP, e.g. try to get a $handlerInstance here
         */
        public function discoverDecodedRecipients (array $decodedData) {
                // First clear all recipients
@@ -107,18 +108,18 @@ class PackageRecipientDiscovery extends BaseHubDiscovery implements Discoverable
                $recipient = explode(':', $decodedData[NetworkPackage::PACKAGE_DATA_RECIPIENT]);
 
                // Is the 'recipient' field same as this peer's IP?
-               if ($recipient[0] == HubTools::determineOwnExternalIp()) {
+               if ((($recipient[0] == HubTools::determineOwnExternalIp()) && ($recipient[1] == $this->getConfigInstance()->getConfigEntry('node_tcp_listen_port'))) || ($recipient[0] == ConsoleTools::acquireSelfIPAddress())) {
                        /*
-                        * Is same as own external IP, don't do anything here so other
+                        * Is same as own external IP+TCP port or internal IP, don't do anything here so other
                         * classes found an empty recipient list for internal (own) handling
                         * of the original content.
                         */
 
                        // Debug output (may flood)
-                       /* NOISY-DEBUG: */ $this->debugOutput('RECIPIENT-DISCOVERY: Recipient ' . $recipient[0] . ' matches own ip (' .  HubTools::determineOwnExternalIp() . ')');
+                       /* NOISY-DEBUG: */ $this->debugOutput('RECIPIENT-DISCOVERY: Recipient ' . $recipient[0] . ' matches own ip (' .  HubTools::determineOwnExternalIp() . ' or ' . ConsoleTools::acquireSelfIPAddress() . ')');
                } else {
                        // Debug output (may flood)
-                       /* NOISY-DEBUG: */ $this->debugOutput('RECIPIENT-DISCOVERY: Recipient ' . $recipient[0] . ' is different than own ip (' .  HubTools::determineOwnExternalIp() . '), need to forward (not yet implemented)!');
+                       /* NOISY-DEBUG: */ $this->debugOutput('RECIPIENT-DISCOVERY: Recipient ' . $recipient[0] . ' is different than own external ip (' .  HubTools::determineOwnExternalIp() . ') nor internal ip (' . ConsoleTools::acquireSelfIPAddress() . '), need to forward (not yet implemented)!');
 
                        // This package is to be delivered to someone else, so add it
                        $this->getListInstance()->addEntry('ip_port', $decodedData[NetworkPackage::PACKAGE_DATA_RECIPIENT]);
index ee4879dd877fabef170183d84737e233ef7d3a7c..46947163075aca4e2a040d766767406379d894e0 100644 (file)
@@ -23,6 +23,7 @@
 ./application/hub/main/database/wrapper/states/class_PeerStateLookupDatabaseWrapper.php:177:    * @todo        Unfinished area
 ./application/hub/main/database/wrapper/states/class_PeerStateLookupDatabaseWrapper.php:219:    * @todo        Unfinished area
 ./application/hub/main/discovery/package/class_PackageRecipientDiscovery.php:100:       * @todo        Add some validation of recipient field, e.g. ip:port is found
+./application/hub/main/discovery/package/class_PackageRecipientDiscovery.php:101:       * @todo        The if() does only check for TCP, not UDP, e.g. try to get a $handlerInstance here
 ./application/hub/main/factories/socket/class_SocketFactory.php:10: * @todo            Find an interface for hub helper
 ./application/hub/main/filter/bootstrap/chat/class_ChatBootstrapGenericActivationFilter.php:54:         * @todo        Maybe we want to do somthing more here?
 ./application/hub/main/filter/bootstrap/cruncher/class_CruncherBootstrapBufferQueueInitializerFilter.php:54:    * @todo        0% done