$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
*/
// 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]);
/**
* 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();
$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));
-Subproject commit e10ada14e2f86607a9d165dac6f7fb154e0be4eb
+Subproject commit 90c5b8005aff620af19c89e0fba2ad1a9198683a