[TASK] Implemented countActiveConnections().
This commit is contained in:
@@ -180,5 +180,18 @@ class Connection_ConnectionPool {
|
||||
public function countSockets() {
|
||||
return $this->socketPool->countSockets();
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the amount of active connections.
|
||||
* A connection is active when the handler is connected.
|
||||
* @return int
|
||||
*/
|
||||
public function countActiveConnections() {
|
||||
$count = 0;
|
||||
foreach($this->connectionHandlers AS $connectionHandler) {
|
||||
if($connectionHandler->isConnected() === TRUE) $count++;
|
||||
}
|
||||
return $count;
|
||||
}
|
||||
}
|
||||
?>
|
||||
Reference in New Issue
Block a user