[TASK] Added the reconnect-flag that works now.

This commit is contained in:
Jan Philipp Timme
2010-11-28 16:38:03 +00:00
parent b318595783
commit a20a91bf12
7 changed files with 166 additions and 8 deletions
+17
View File
@@ -80,7 +80,24 @@ class Client_ClientManager {
foreach($connectionHandlers["read"] AS $connectionHandler) {
//handle disconnects
if($connectionHandler->isConnected() === FALSE && $connectionHandler->isListening() === FALSE) {
//check whether the reconnect-flag is set
if($connectionHandler->getReconnect() === TRUE) {
//have the connectionHandler do the reconnect.
$newConnectionHandler = $connectionHandler->reconnect();
//get the client and reset it.
$client = $this->clientPool[$connectionHandler->getID()];
$client->resetConnectionStatus();
//assign the client to the new connectionHandler.
$this->clientPool[$newConnectionHandler->getID()] = $client;
//get the config and assign it to the new connectionHandler, too.
$config = $this->configPool[$connectionHandler->getID()];
$this->configPool[$newConnectionHandler->getID()] = $config;
//remove old connection
$this->removeConnection($connectionHandler);
}
$this->removeClientForConnectionHandler($connectionHandler);
//reconnect or not - this connectionHandler won't do that much.
continue;
}
//handle accepted sockets, adopt them and treat them with care :-)
if($connectionHandler->isListening() === TRUE) {