public function onClose($server, $fd, $from_id)
{
if (!empty($this->client_pool)) {
foreach ($this->client_pool as $k => $v) {
if ($v['fd'] == $fd) {
DistributedClient::getInstance()->removeuser($v['remote_ip'], 'Distributed');
print_r($v['remote_ip'] . " have closed\n");
unset($this->client_pool[$k]);
}
}
} else {
DistributedClient::getInstance()->removeuser($this->localip, 'Distributed');
print_r($this->localip . " have closed\n");
}
}