$discoveryInstance = PackageDiscoveryFactory::createPackageDiscoveryInstance();
// ... then disover all recipient (might be only one), this package may shall be forwarded
- $discoveryInstance->discoverDecodedRecipients($decodedData);
+ $discoveryInstance->discoverRawRecipients($decodedData);
// Check for 'recipient' field (the 'sender' field and others are ignored here)
if ($discoveryInstance->isRecipientListEmpty()) {
$this->getStackerInstance()->pushNamed(self::STACKER_NAME_DECODED_PACKAGE, $decodedData);
} else {
// Forward the package to the next node
- $this->getPackageInstance()->forwardDecodedPackage($decodedData);
+ $this->getPackageInstance()->forwardRawPackage($decodedData);
}
}
/**
* Checks whether decoded packages have arrived (for this peer)
*
- * @return $ifDecodedPackagesLeft Whether decoded packages have arrived
+ * @return $ifRawPackagesLeft Whether decoded packages have arrived
*/
public function ifDeocedPackagesLeft () {
// Check it ...
- $ifDecodedPackagesLeft = (!$this->getStackerInstance()->isStackEmpty(self::STACKER_NAME_DECODED_PACKAGE));
+ $ifRawPackagesLeft = (!$this->getStackerInstance()->isStackEmpty(self::STACKER_NAME_DECODED_PACKAGE));
// ... return it
- return $ifDecodedPackagesLeft;
+ return $ifRawPackagesLeft;
}
/**
* @return void
*/
public function handleDecodedPackage () {
+ // Assert on amount
+ assert($this->ifDeocedPackagesLeft());
+
// Get the next entry (assoziative array)
$decodedData = $this->getStackerInstance()->popNamed(self::STACKER_NAME_DECODED_PACKAGE);
// Handle it
- $this->getPackageInstance()->handleDecodedData($decodedData);
+ $this->getPackageInstance()->handleRawData($decodedData);
}
}