* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
class BaseListener extends BaseHubSystem {
+ /**
+ * Used protocol (Default: invalid, which is invalid...)
+ */
+ private $protcol = 'invalid';
+
/**
* Address (IP mostly) we shall listen on
*/
public final function setListenPortByConfiguration ($configEntry) {
$this->setListenPort($this->getConfigInstance()->readConfig($configEntry));
}
+
+ /**
+ * Setter for protocol
+ *
+ * @param $protocol Used protocol
+ * @return void
+ */
+ protected final function setProtocol ($protocol) {
+ $this->protocol = (string) $protocol;
+ }
+
+ /**
+ * Getter for protocol
+ *
+ * @return $protocol Used protocol
+ */
+ public final function getProtocol () {
+ return $this->protocol;
+ }
}
// [EOF]
public final function getListenPort () {
return $this->getListenerInstance()->getListenPort();
}
+
+ /**
+ * Getter for protocol
+ *
+ * @return $protocol The used protocol
+ */
+ public final function getProtocol () {
+ return $this->getListenerInstance()->getProtocol();
+ }
}
// [EOF]
// Set the application instance
$listenerInstance->setNodeInstance($nodeInstance);
+ // Set the protocol to TCP
+ $listenerInstance->setProtocol('tcp');
+
// Return the prepared instance
return $listenerInstance;
}
// Set the application instance
$listenerInstance->setNodeInstance($nodeInstance);
+ // Set the protocol to UDP
+ $listenerInstance->setProtocol('udp');
+
// Return the prepared instance
return $listenerInstance;
}
* @param $instance An instance of a class we should add to the pool
* @return void
*/
- protected final function addInstance($poolName, FrameworkInterface $instance) {
- $this->instancePool[$poolName][] = $instance;
+ protected final function addInstance($group, $poolName, FrameworkInterface $instance) {
+ $this->instancePool[$group][$poolName][] = $instance;
}
}
*/
public function addListener (Listenable $listenerInstance) {
// Add this listener instance to the instance list
- parent::addInstance('listener', $listenerInstance);
+ parent::addInstance($listenerInstance->getProtocol(), 'listener', $listenerInstance);
// Debug message
$this->getDebugInstance()->output(