X-Git-Url: https://git.mxchange.org/?a=blobdiff_plain;f=application%2Fhub%2Fmain%2Flistener%2Fclass_BaseListener.php;h=b81ffd2027d98f28c52c1a78a443f4fb2b481cad;hb=c2dac8c1ddfb2ae0ee6ceea404a3997238539e05;hp=7bbf70b00241e819b840ba65ba7949fcd476e0a1;hpb=3fd3a9c63f118a180da6e19e8f76cb989d74f782;p=hub.git diff --git a/application/hub/main/listener/class_BaseListener.php b/application/hub/main/listener/class_BaseListener.php index 7bbf70b00..b81ffd202 100644 --- a/application/hub/main/listener/class_BaseListener.php +++ b/application/hub/main/listener/class_BaseListener.php @@ -4,7 +4,7 @@ * * @author Roland Haeder * @version 0.0.0 - * @copyright Copyright (c) 2007, 2008 Roland Haeder, 2009, 2010 Hub Developer Team + * @copyright Copyright (c) 2007, 2008 Roland Haeder, 2009 - 2011 Hub Developer Team * @license GNU GPL 3.0 or any newer version * @link http://www.ship-simu.org * @@ -29,7 +29,7 @@ class BaseListener extends BaseHubSystem implements Visitable { /** * Used protocol (Default: invalid, which is indeed invalid...) */ - private $protcol = 'invalid'; + private $protocol = 'invalid'; /** * Address (IP mostly) we shall listen on @@ -47,15 +47,10 @@ class BaseListener extends BaseHubSystem implements Visitable { private $blockingMode = false; /** - * A client pool instance + * A peer pool instance */ private $poolInstance = null; - /** - * A network package handler instance - */ - private $packageInstance = null; - /** * Protected constructor * @@ -80,6 +75,7 @@ class BaseListener extends BaseHubSystem implements Visitable { // We need to clear the error here if it is a resource if ($isServerSocket === true) { // Clear the error + //* DEBUG: */ $this->debugOutput('socketResource[]=' . gettype($socketResource)); socket_clear_error($socketResource); } // END - if @@ -196,43 +192,24 @@ class BaseListener extends BaseHubSystem implements Visitable { } /** - * Setter for client pool instance + * Setter for peer pool instance * - * @param $poolInstance The client pool instance we shall set + * @param $poolInstance The peer pool instance we shall set * @return void */ - protected final function setPoolInstance (PoolableClient $poolInstance) { + protected final function setPoolInstance (PoolablePeer $poolInstance) { $this->poolInstance = $poolInstance; } /** - * Getter for client pool instance + * Getter for peer pool instance * - * @return $poolInstance The client pool instance we shall set + * @return $poolInstance The peer pool instance we shall set */ - protected final function getPoolInstance () { + public final function getPoolInstance () { return $this->poolInstance; } - /** - * Setter for network package handler instance - * - * @param $packageInstance The network package handler instance we shall set - * @return void - */ - protected final function setPackageInstance (Networkable $packageInstance) { - $this->packageInstance = $packageInstance; - } - - /** - * Getter for network package handler instance - * - * @return $packageInstance The network package handler instance we shall set - */ - protected final function getPackageInstance () { - return $this->packageInstance; - } - /** * Registeres the given socket resource for "this" listener instance. This * will be done in a seperate class to allow package writers to use it @@ -301,7 +278,7 @@ class BaseListener extends BaseHubSystem implements Visitable { */ public function accept (Visitor $visitorInstance) { // Debug message - //* DEBUG: */ $this->debugOutput('LISTENER: ' . $visitorInstance->__toString() . ' has visited ' . $this->__toString() . ' - START'); + //* DEBUG: */ $this->debugOutput(strtoupper($this->getProtocol()) . '-LISTENER: ' . $visitorInstance->__toString() . ' has visited ' . $this->__toString() . ' - START'); // Visit this listener $visitorInstance->visitListener($this); @@ -312,7 +289,20 @@ class BaseListener extends BaseHubSystem implements Visitable { } // END - if // Debug message - //* DEBUG: */ $this->debugOutput('LISTENER: ' . $visitorInstance->__toString() . ' has visited ' . $this->__toString() . ' - FINISHED'); + //* DEBUG: */ $this->debugOutput(strtoupper($this->getProtocol()) . '-LISTENER: ' . $visitorInstance->__toString() . ' has visited ' . $this->__toString() . ' - FINISHED'); + } + + /** + * Monitors incoming raw data from the handler and transfers it to the + * given receiver instance. This method should not be called, please call + * the decorator's version instead to seperator node/client traffic. + * + * @param $receiverInstance An instance of a Receivable class + * @return void + * @throws UnsupportedOperatorException If this method is called by a mistake + */ + public function monitorIncomingRawData (Receivable $receiverInstance) { + throw new UnsupportedOperationException(array($this, __FUNCTION__, $receiverInstance), self::EXCEPTION_UNSPPORTED_OPERATION); } }