src/Handler.php
protected function listenSocket(): Generator
    {
        yield Dispatcher::listenRead($this->server);
        $handle = fopen($this->locker, 'a');

        if ($handle && flock($handle, LOCK_EX)) {
            yield Dispatcher::async($this->acceptSocket());
            flock($handle, LOCK_UN);
        }

        fclose($handle);
        yield Dispatcher::async($this->listenSocket());
    }
protected function listenSocket(): Generator
    {
        yield Dispatcher::listenRead($this->server);
        $handle = fopen($this->locker, 'a');

        if ($handle && flock($handle, LOCK_EX)) {
            yield Dispatcher::async($this->acceptSocket());
            flock($handle, LOCK_UN);
        }

        fclose($handle);
        yield Dispatcher::async($this->listenSocket());
    }
protected function listenSocket ( ) : Generator { yield Dispatcher :: listenRead ( $ this -> server ) ; $ handle = fopen ( $ this -> locker , 'a' ) ; if ( $ handle && flock ( $ handle , LOCK_EX ) ) { yield Dispatcher :: async ( $ this -> acceptSocket ( ) ) ; flock ( $ handle , LOCK_UN ) ; } fclose ( $ handle ) ; yield Dispatcher :: async ( $ this -> listenSocket ( ) ) ; }
Main socket listener

@return Generator
Main socket listener