From: Roland Haeder Date: Sun, 24 May 2015 21:10:58 +0000 (+0200) Subject: This should fix it ... ;-) X-Git-Url: https://git.mxchange.org/?a=commitdiff_plain;h=4dc608864eeb18232933758d9a2d4fcfcfa8dcf1;p=hub.git This should fix it ... ;-) Signed-off-by: Roland Haeder --- diff --git a/application/hub/main/discovery/recipient/package/class_PackageRecipientDiscovery.php b/application/hub/main/discovery/recipient/package/class_PackageRecipientDiscovery.php index f878eb772..72e879400 100644 --- a/application/hub/main/discovery/recipient/package/class_PackageRecipientDiscovery.php +++ b/application/hub/main/discovery/recipient/package/class_PackageRecipientDiscovery.php @@ -97,7 +97,7 @@ class PackageRecipientDiscovery extends BaseRecipientDiscovery implements Discov $handlerInstance = ProtocolHandlerFactory::createProtocolHandlerFromPackageData($decodedData); // Is the 'recipient' field same as this peer's IP? - if ($handlerInstance->isOwnAddress()) { + if ($handlerInstance->isOwnAddress($decodedData[NetworkPackage::PACKAGE_DATA_RECIPIENT])) { /* * Is same as own external address + TCP/UDP listen port or * internal address, don't do anything here so other classes found @@ -106,10 +106,10 @@ class PackageRecipientDiscovery extends BaseRecipientDiscovery implements Discov */ // Debug output (may flood) - /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__)->debugOutput('RECIPIENT-DISCOVERY[' . __METHOD__ . ':' . __LINE__ . ']: Recipient matches own ip (external=' . HubTools::determineOwnExternalAddress() . ' or internal=' . HubTools::determineOwnInternalAddress() . ')'); + /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__)->debugOutput('RECIPIENT-DISCOVERY[' . __METHOD__ . ':' . __LINE__ . ']: Recipient ' . $decodedData[NetworkPackage::PACKAGE_DATA_RECIPIENT] . ' matches own ip (external=' . HubTools::determineOwnExternalAddress() . ' or internal=' . HubTools::determineOwnInternalAddress() . ')'); } else { // Debug output (may flood) - /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__)->debugOutput('RECIPIENT-DISCOVERY[' . __METHOD__ . ':' . __LINE__ . ']: Recipient is different than own external address (' . HubTools::determineOwnExternalAddress() . ') nor internal address (' . HubTools::determineOwnInternalAddress() . '), need to forward (not yet implemented)!'); + /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__)->debugOutput('RECIPIENT-DISCOVERY[' . __METHOD__ . ':' . __LINE__ . ']: Recipient ' . $decodedData[NetworkPackage::PACKAGE_DATA_RECIPIENT] . ' is different than own external address (' . HubTools::determineOwnExternalAddress() . ') nor internal address (' . HubTools::determineOwnInternalAddress() . '), need to forward (not yet implemented)!'); // This package is to be delivered to someone else, so add it // @TODO Unfinished: $this->getListInstance()->addEntry('unl', $decodedData[NetworkPackage::PACKAGE_DATA_RECIPIENT]); diff --git a/application/hub/main/handler/protocol/class_BaseProtocolHandler.php b/application/hub/main/handler/protocol/class_BaseProtocolHandler.php index 3a840767a..af5d37aa2 100644 --- a/application/hub/main/handler/protocol/class_BaseProtocolHandler.php +++ b/application/hub/main/handler/protocol/class_BaseProtocolHandler.php @@ -196,12 +196,10 @@ class BaseProtocolHandler extends BaseHandler { /** * If the found UNL (address) matches own external or internal address * + * @param $unl UNL to test * @return $ifMatches Whether the found UNL matches own addresss */ - public function isOwnAddress () { - // Get current UNL (from universalNodeLocatorData array) - $currentUnl = $this->getCurrentUniversalNodeLocator(); - + public function isOwnAddress ($unl) { // Get own external UNL $externalUnl = HubTools::determineOwnExternalAddress(); @@ -209,11 +207,11 @@ class BaseProtocolHandler extends BaseHandler { $internalUnl = HubTools::determineOwnInternalAddress(); // Debug message - /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__)->debugOutput('[' . __METHOD__ . ':' . __LINE__ . ']: currentUnl=' . $currentUnl . ',externalUnl=' . $externalUnl . ',internalUnl=' . $internalUnl); - //* DIE-DEBUG: */ die(__METHOD__.':currentUnl=' . $currentUnl . ',this='.print_r($this, TRUE)); + /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__)->debugOutput('[' . __METHOD__ . ':' . __LINE__ . ']: unl=' . $unl . ',externalUnl=' . $externalUnl . ',internalUnl=' . $internalUnl); + //* DIE-DEBUG: */ die(__METHOD__.':unl=' . $unl . ',this='.print_r($this, TRUE)); // Is it the same? - $ifMatches = (($currentUnl === $externalUnl) || ($currentUnl === $internalUnl)); + $ifMatches = (($unl === $externalUnl) || ($unl === $internalUnl)); // Debug message //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__)->debugOutput('[' . __METHOD__ . ':' . __LINE__ . ']: ifMatches=' . intval($ifMatches)); diff --git a/core b/core index e10ada14e..90c5b8005 160000 --- a/core +++ b/core @@ -1 +1 @@ -Subproject commit e10ada14e2f86607a9d165dac6f7fb154e0be4eb +Subproject commit 90c5b8005aff620af19c89e0fba2ad1a9198683a