コード例 #1
0
ファイル: HttpRequest.php プロジェクト: domraider/rxnet
 public function dispose()
 {
     if (!$this->stream instanceof Stream) {
         parent::dispose();
         return;
     }
     if ($socket = $this->stream->getSocket()) {
         EventLoop::getLoop()->removeReadStream($socket);
         if (is_resource($socket)) {
             @fclose($socket);
         }
     }
     parent::dispose();
 }
コード例 #2
0
ファイル: BufferedStream.php プロジェクト: domraider/rxnet
 /**
  * Transport constructor.
  * @param $socket
  * @param LoopInterface $loop
  */
 public function __construct($socket, LoopInterface $loop)
 {
     parent::__construct($socket, $loop);
     $this->loop->addReadStream($this->socket, [$this, 'readSocket']);
 }