public function onClose($server, $fd, $fromId)
{
$host = Host::getHostByFd($fd);
if ($host) {
# 已经有连接上的服务器
Server::$instance->info("host#{$host->group}.{$host->id}({$host->ip}:{$host->port}) close connection.");
$host->remove();
# 移除服务
foreach (Host::$table as $item) {
if ($item['group'] === $host->group && $item['id'] === $host->id || $item['removed']) {
continue;
}
# 通知所有客户端移除
RPC::factory($item['fd'], $item['from_id'])->trigger('server.remove', $host->group, $host->id);
}
}
}