[TASK] Did some small changes in the code. Also updated some comments.
This commit is contained in:
@@ -78,7 +78,7 @@ class Client_ClientManager {
|
||||
}
|
||||
|
||||
/**
|
||||
* Main worker function.
|
||||
* Main worker procedure.
|
||||
* Processes incoming data, calls clients and much more.
|
||||
* @return void
|
||||
*/
|
||||
@@ -121,6 +121,8 @@ class Client_ClientManager {
|
||||
//call the registered client
|
||||
if(isset($this->clientPool[$connectionHandler->getID()])) $outgoingData .= $this->clientPool[$connectionHandler->getID()]->processRawData($incomingData);
|
||||
|
||||
//i don't know what to do here... maybe call a connection bridge?
|
||||
|
||||
//output will be sent.
|
||||
if($outgoingData !== "") $connectionHandler->write($result);
|
||||
}
|
||||
@@ -196,9 +198,7 @@ class Client_ClientManager {
|
||||
*/
|
||||
public function getIDs() {
|
||||
$list = array();
|
||||
foreach($this->connectionPool->getConnectionHandlers() AS $connectionHandler) {
|
||||
$list[] = $connectionHandler->getID();
|
||||
}
|
||||
foreach($this->connectionPool->getConnectionHandlers() AS $connectionHandler) $list[] = $connectionHandler->getID();
|
||||
return $list;
|
||||
}
|
||||
|
||||
@@ -208,9 +208,7 @@ class Client_ClientManager {
|
||||
*/
|
||||
public function getGroups() {
|
||||
$list = array();
|
||||
foreach($this->connectionPool->getConnectionHandlers() AS $connectionHandler) {
|
||||
$list[] = $connectionHandler->getGroup();
|
||||
}
|
||||
foreach($this->connectionPool->getConnectionHandlers() AS $connectionHandler) $list[] = $connectionHandler->getGroup();
|
||||
return $list;
|
||||
}
|
||||
|
||||
@@ -240,6 +238,7 @@ class Client_ClientManager {
|
||||
$className = "Client_" . $protocol . "Client";
|
||||
//look for the class
|
||||
if(class_exists($className)) {
|
||||
//TODO: This looks ugly and wrong. Ideas, anyone?
|
||||
$client = new $className();
|
||||
if(!$client instanceof Client_AbstractClient) throw new Exception_GeneralException("Class '" . $className . "' does not implement the AbstractClient-API!", 1294837055);
|
||||
return $client;
|
||||
@@ -299,6 +298,7 @@ class Client_ClientManager {
|
||||
}
|
||||
$client->injectClientManager($this);
|
||||
$protocolHandlerClass = "Protocol_".$protocol."ProtocolHandler";
|
||||
//TODO: This looks ugly, too. Is there a better way?
|
||||
$protocolHandler = new $protocolHandlerClass();
|
||||
$client->injectProtocolHandler($protocolHandler);
|
||||
$client->setID($connectionHandler->getID());
|
||||
|
||||
Reference in New Issue
Block a user