public function onClose(Connection $conn)
    {
        $this->onPublishResponse($conn, "CONN_CLOSED", new NsqException("connection close, maybe disposable connection timeout"));

        if (!$conn->isDisposable()) {
            $this->lookup->removeConnection($conn);

            $remainConnNum = count($this->getNsqdConns());
            sys_echo("nsq({$conn->getAddr()}) producer onClose: there are $remainConnNum connections left alive");

            if ($this->lookup->isStopped()/* && $remainConnNum === 0*/) {
                return;
            }

            Task::execute($this->reconnectToNSQD($conn));
        }
    }
public function onClose(Connection $conn)
    {
        $this->onPublishResponse($conn, "CONN_CLOSED", new NsqException("connection close, maybe disposable connection timeout"));

        if (!$conn->isDisposable()) {
            $this->lookup->removeConnection($conn);

            $remainConnNum = count($this->getNsqdConns());
            sys_echo("nsq({$conn->getAddr()}) producer onClose: there are $remainConnNum connections left alive");

            if ($this->lookup->isStopped()/* && $remainConnNum === 0*/) {
                return;
            }

            Task::execute($this->reconnectToNSQD($conn));
        }
    }
public function onClose ( Connection $ conn ) { $ this -> onPublishResponse ( $ conn , "CONN_CLOSED" , new NsqException ( "connection close, maybe disposable connection timeout" ) ) ; if ( ! $ conn -> isDisposable ( ) ) { $ this -> lookup -> removeConnection ( $ conn ) ; $ remainConnNum = count ( $ this -> getNsqdConns ( ) ) ; sys_echo ( "nsq({$conn->getAddr()}) producer onClose: there are $remainConnNum connections left alive" ) ; if ( $ this -> lookup -> isStopped ( ) /* && $remainConnNum === 0*/ ) { return ; } Task :: execute ( $ this -> reconnectToNSQD ( $ conn ) ) ; } }
OnClose is called when the connection
closes, after all cleanup
@param Connection $conn
@throws NsqException
@return void
OnClose is called when the connection closes after all cleanup