* @param $packageData Raw package data in an array
* @return void
*/
- private function deliverPackage (array $packageData) {
+ private function declareRawPackageData (array $packageData) {
/*
* 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
}
/**
- * Sends a raw package out
+ * Delivers raw package data. In short, this will discover the raw socket
+ * resource through a discovery class (which will analyse the receipient of
+ * the package), register the socket with the connection (handler/helper?)
+ * instance and finally push the raw data on our outgoing queue.
*
* @param $packageData Raw package data in an array
* @return void
*/
- private function sendRawPackage (array $packageData) {
+ private function deliverRawPackageData (array $packageData) {
/*
* This package may become big, depending on the shared object size or
* delivered message size which shouldn't be so long (to save
* @param $packageData Raw package data
* @return void
*/
- private function sendOutgoingPackage (array $packageData) {
+ private function sendOutgoingRawPackageData (array $packageData) {
// Get the right connection instance
$connectionInstance = SocketRegistry::createSocketRegistry()->getHandlerInstanceFromPackageData($packageData);
*
* @return $isWaitingDelivery Wether a package is waiting for delivery
*/
- public function isPackageWaitingDelivery () {
+ public function isPackageWaitingForDelivery () {
// Check wether the stacker is not empty
$isWaitingDelivery = (($this->getStackerInstance()->isStackInitialized(self::STACKER_NAME_OUTGOING)) && (!$this->getStackerInstance()->isStackEmpty(self::STACKER_NAME_OUTGOING)));
// with the first one.
$packageData = $this->getStackerInstance()->getNamed(self::STACKER_NAME_UNDECLARED);
- // Finally, deliver the package
- $this->deliverPackage($packageData);
+ // Declare the raw package data for delivery
+ $this->declareRawPackageData($packageData);
// And remove it finally
$this->getStackerInstance()->popNamed(self::STACKER_NAME_UNDECLARED);
$packageData = $this->getStackerInstance()->getNamed(self::STACKER_NAME_DECLARED);
// And send it
- $this->sendRawPackage($packageData);
+ $this->deliverRawPackageData($packageData);
// And remove it finally
$this->getStackerInstance()->popNamed(self::STACKER_NAME_DECLARED);
$this->sendBackBufferBytes();
// Sanity check if we have packages waiting for delivery
- if (!$this->isPackageWaitingDelivery()) {
+ if (!$this->isPackageWaitingForDelivery()) {
// This is not fatal but should be avoided
// @TODO Add some logging here
return;
try {
// Now try to send it
- $this->sendOutgoingPackage($packageData);
+ $this->sendOutgoingRawPackageData($packageData);
die("O!\n");
// And remove it finally