*/
public function discoverRecipients (array $packageData) {
// This must be available
+ //* DEBUG: */ print $this->__toString() . ': packageData=' . print_r($packageData, TRUE);
assert(isset($packageData[NetworkPackage::PACKAGE_DATA_RECIPIENT]));
// First try out the direct recipient (session id)
* @return void
*/
private function declareRawPackageData (array $packageData) {
+ // Make sure the required field is there
+ assert(isset($packageData[self::PACKAGE_DATA_RECIPIENT]));
+
/*
* We need to disover every recipient, just in case we have a
* multi-recipient entry like 'upper' is. 'all' may be a not so good
* Now there are for sure packages to deliver, so start with the first
* one.
*/
- $packageData = $this->getStackerInstance()->getNamed(self::STACKER_NAME_UNDECLARED);
+ $packageData = $this->getStackerInstance()->popNamed(self::STACKER_NAME_UNDECLARED);
// Declare the raw package data for delivery
$this->declareRawPackageData($packageData);
-
- // And remove it finally
- $this->getStackerInstance()->popNamed(self::STACKER_NAME_UNDECLARED);
}
/**
// Get the package
$packageData = $this->getStackerInstance()->getNamed(self::STACKER_NAME_DECLARED);
+ // Assert on it
+ assert($packageData[self::PACKAGE_DATA_RECIPIENT]);
+
+ // Try to deliver the package
try {
// And try to send it
$this->deliverRawPackageData($packageData);