/**
* Getter for peer pool instance
*
- * @return $poolInstance The peer pool instance we shall set
+ * @return $poolInstance A peer pool instance
*/
public final function getPoolInstance () {
return $this->getListenerInstance()->getPoolInstance();
* @return void
*/
public function monitorIncomingRawData (Receivable $receiverInstance) {
+ // Get the handler instance
+ $handlerInstance = $this->getListenerInstance()->getHandlerInstance();
+
/*
* Does our deocorated listener (or even a decorator again) have a
* handler assigned? Remember that a handler will hold all incoming raw
* data and not a listener.
*/
- if (!$this->getListenerInstance()->getHandlerInstance() instanceof Networkable) {
+ if (!$handlerInstance instanceof Networkable) {
// Skip this silently for now. Later on, this will become mandatory!
//* NOISY-DEBUG: */ $this->debugOutput('No handler assigned to this listener decorator. this=' . $this->__toString() . ', listenerInstance=' . $this->getListenerInstance()->__toString());
return;
} // END - if
+
+ // Does the handler have some decoded data pending?
+ if (!$handlerInstance->isDecodedDataPending()) {
+ // No data is pending so skip further code silently
+ return;
+ } // END - if
+
+ /*
+ * We have some pending decoded data. The receiver instance is an
+ * abstract network package (which can be received and sent out) so
+ * handle the decoded data over. At this moment we don't need to know
+ * if the decoded data origins from a TCP or UDP connection so we can
+ * just pass it over to the network package receiver
+ */
+ $receiverInstance->addDecodedDataToIncomingStack($handlerInstance);
}
}