[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
+5 -3
View File
@@ -50,6 +50,8 @@ class Connection_ConnectionPool {
public function createTcpConnection($group = "", $protocol = "RAW", $IPv6 = FALSE) {
$socket = $this->socketPool->createTcpSocket($IPv6);
$connectionHandler = new Connection_ConnectionHandler($socket, $this->nextID, $group, $protocol);
$connectionHandler->setIPv6($IPv6);
$connectionHandler->injectConnectionPool($this);
$this->addConnectionHandler($connectionHandler);
return $connectionHandler;
}
@@ -117,13 +119,13 @@ class Connection_ConnectionPool {
$connectionHandler = $this->getConnectionHandlerForSocketRessource($socket);
switch($selectedType) {
case "read":
if($connectionHandler->isServer() === FALSE) {
if($connectionHandler->readToBuffer() === FALSE) $this->removeConnectionHandler($connectionHandler);
} else {
if($connectionHandler->isServer() === TRUE) {
$acceptedSocket = $connectionHandler->accept();
$acceptedSocketHandler = new Connection_ConnectionHandler($acceptedSocket, $this->nextID, $connectionHandler->getGroup(), $connectionHandler->getProtocol());
$acceptedSocketHandler->hasBeenAccepted();
$this->addConnectionHandler($acceptedSocketHandler);
} else {
$connectionHandler->readToBuffer();
}
break;
case "write":