DistributedServer::onClose PHP Méthode

onClose() public méthode

服务器断开连接
public onClose ( $server, $fd, $from_id )
    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");
        }
    }