[TASK] Added the reconnect-flag that works now.
This commit is contained in:
@@ -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) {
|
||||
|
||||
Reference in New Issue
Block a user