src/Server.php
public function endConnection(ConnectionInterface $stream)
    {
        $tid = true;
        $loop = $this->loop;

        // cancel below timer in case connection is closed in time
        $stream->once('close', function () use (&$tid, $loop) {
            // close event called before the timer was set up, so everything is okay
            if ($tid === true) {
                // make sure to not start a useless timer
                $tid = false;
            } else {
                $loop->cancelTimer($tid);
            }
        });

        // shut down connection by pausing input data, flushing outgoing buffer and then exit
        $stream->pause();
        $stream->end();

        // check if connection is not already closed
        if ($tid === true) {
            // fall back to forcefully close connection in 3 seconds if buffer can not be flushed
            $tid = $loop->addTimer(3.0, array($stream,'close'));
        }
    }
public function endConnection(ConnectionInterface $stream)
    {
        $tid = true;
        $loop = $this->loop;

        // cancel below timer in case connection is closed in time
        $stream->once('close', function () use (&$tid, $loop) {
            // close event called before the timer was set up, so everything is okay
            if ($tid === true) {
                // make sure to not start a useless timer
                $tid = false;
            } else {
                $loop->cancelTimer($tid);
            }
        });

        // shut down connection by pausing input data, flushing outgoing buffer and then exit
        $stream->pause();
        $stream->end();

        // check if connection is not already closed
        if ($tid === true) {
            // fall back to forcefully close connection in 3 seconds if buffer can not be flushed
            $tid = $loop->addTimer(3.0, array($stream,'close'));
        }
    }
public function endConnection ( ConnectionInterface $ stream ) { $ tid = true ; $ loop = $ this -> loop ; // cancel below timer in case connection is closed in time $ stream -> once ( 'close' , function ( ) use ( & $ tid , $ loop ) { // close event called before the timer was set up, so everything is okay if ( $ tid === true ) { // make sure to not start a useless timer $ tid = false ; } else { $ loop -> cancelTimer ( $ tid ) ; } } ) ; // shut down connection by pausing input data, flushing outgoing buffer and then exit $ stream -> pause ( ) ; $ stream -> end ( ) ; // check if connection is not already closed if ( $ tid === true ) { // fall back to forcefully close connection in 3 seconds if buffer can not be flushed $ tid = $ loop -> addTimer ( 3.0 , array ( $ stream , 'close' ) ) ; } }
[internal] gracefully shutdown connection by flushing all remaining data and closing stream

@internal
[ internal ] gracefully shutdown connection by flushing all remaining data and closing stream