当前位置: 首页>>代码示例>>PHP>>正文


PHP LoopInterface::removeReadStream方法代码示例

本文整理汇总了PHP中React\EventLoop\LoopInterface::removeReadStream方法的典型用法代码示例。如果您正苦于以下问题:PHP LoopInterface::removeReadStream方法的具体用法?PHP LoopInterface::removeReadStream怎么用?PHP LoopInterface::removeReadStream使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在React\EventLoop\LoopInterface的用法示例。


在下文中一共展示了LoopInterface::removeReadStream方法的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: close

 /**
  *
  */
 public function close()
 {
     $this->loop->removeReadStream($this->socket);
     if (is_resource($this->socket)) {
         fclose($this->socket);
     }
     $this->notifyCompleted();
 }
开发者ID:domraider,项目名称:rxnet,代码行数:11,代码来源:Datagram.php

示例2: del

 /**
  * Remove event listener from event loop.
  *
  * @param mixed $fd
  * @param int   $flag
  * @return bool
  */
 public function del($fd, $flag)
 {
     switch ($flag) {
         case EventInterface::EV_READ:
             return $this->_loop->removeReadStream($fd);
         case EventInterface::EV_WRITE:
             return $this->_loop->removeWriteStream($fd);
         case EventInterface::EV_SIGNAL:
             return $this->_loop->removeSignal($fd);
         case EventInterface::EV_TIMER:
         case EventInterface::EV_TIMER_ONCE:
             return $this->_loop->cancelTimer($fd);
     }
     return false;
 }
开发者ID:walkor,项目名称:workerman,代码行数:22,代码来源:React.php

示例3: disconnect

 /**
  * Disconnects client from server.
  *
  * Calling disconnect() multiple times or if client is not connected will result in error.
  *
  * @param int $replyCode
  * @param string $replyText
  * @return Promise\PromiseInterface
  */
 public function disconnect($replyCode = 0, $replyText = "")
 {
     if ($this->state !== ClientStateEnum::CONNECTED) {
         return Promise\reject(new ClientException("Client is not connected."));
     }
     $this->state = ClientStateEnum::DISCONNECTING;
     $promises = [];
     if ($replyCode === 0) {
         foreach ($this->channels as $channel) {
             $promises[] = $channel->close();
         }
     }
     if ($this->heartbeatTimer) {
         $this->heartbeatTimer->cancel();
         $this->heartbeatTimer = null;
     }
     return Promise\all($promises)->then(function () use($replyCode, $replyText) {
         return $this->connectionClose($replyCode, $replyText, 0, 0);
     })->then(function () {
         $this->eventLoop->removeReadStream($this->getStream());
         $this->closeStream();
         $this->init();
         return $this;
     });
 }
开发者ID:Andrewsville,项目名称:bunny,代码行数:34,代码来源:Client.php

示例4: unregister

 protected function unregister()
 {
     if (!$this->active) {
         return;
     }
     $this->active = false;
     $this->loop->removeReadStream($this->fd, [$this, 'handleEvent']);
 }
开发者ID:voidcontext,项目名称:filesystem,代码行数:8,代码来源:Adapter.php

示例5: testRemoveInvalid

 public function testRemoveInvalid()
 {
     $stream = $this->createStream();
     // remove a valid stream from the event loop that was never added in the first place
     $this->loop->removeReadStream($stream);
     $this->loop->removeWriteStream($stream);
     $this->loop->removeStream($stream);
 }
开发者ID:smileytechguy,项目名称:nLine,代码行数:8,代码来源:AbstractLoopTest.php

示例6: close

 /**
  * close the inotifyHandler and clear all pending events (if any)
  */
 public function close()
 {
     if ($this->inotifyHandler !== false) {
         $this->loop->removeReadStream($this->inotifyHandler);
         fclose($this->inotifyHandler);
         $this->inotifyHandler = false;
         $this->watchDescriptors = array();
     }
 }
开发者ID:tufanbarisyildirim,项目名称:react-inotify,代码行数:12,代码来源:Inotify.php

示例7: cancel

 /**
  * Cancel an existing timer/stream watcher
  *
  * @param int $watcherId
  */
 public function cancel($watcherId)
 {
     if (isset($this->watchers[$watcherId])) {
         list($type, $data) = $this->watchers[$watcherId];
         switch ($type) {
             case self::WATCHER_TYPE_READ:
                 $this->reactor->removeReadStream($data);
                 break;
             case self::WATCHER_TYPE_WRITE:
                 $this->reactor->removeWriteStream($data);
                 break;
             case self::WATCHER_TYPE_TIMER:
                 $this->reactor->cancelTimer($data);
                 break;
         }
     }
     unset($this->watchers[$watcherId], $this->disabledWatchers[$watcherId]);
 }
开发者ID:daverandom,项目名称:loopio,代码行数:23,代码来源:Loop.php

示例8: process

 public function process($stream, $loop)
 {
     $response = fgets($stream);
     if ($response === false) {
         $this->state = self::STATE_DISCONNECTED;
         $this->onFailure->__invoke($this->record, "Error while reading data");
         echo $this->errno . ': ' . $this->errstr . PHP_EOL;
         return;
     }
     $code = intval(substr($response, 0, 3));
     $sub = intval($response[4] . $response[6] . $response[8]);
     if (($code === 220 || $code === 250) && $sub === 0) {
         return;
     }
     if ($code === 250 && $sub === 210) {
         $this->state = self::STATE_IDLE;
         return;
     }
     if ($this->record === null) {
         throw new LogicException("Email not set.");
     }
     if ($code === 250 && $sub === 215) {
         $this->onSuccess->__invoke($this->record);
         $this->state = self::STATE_IDLE;
     } else {
         if ($code === 452 && $sub === 453) {
             $this->loop->removeReadStream($this->stream);
             fclose($this->stream);
             $this->onFailure->__invoke($this->record, "limit reached");
             $this->state = self::STATE_DISCONNECTED;
         } else {
             $this->onFailure->__invoke($this->record, false);
             while (substr($response, -7, 5) !== 'gsmtp') {
                 $response = fgets($stream);
             }
             $this->state = self::STATE_IDLE;
         }
     }
 }
开发者ID:Skpd,项目名称:email_tester,代码行数:39,代码来源:AsyncClient.php

示例9: removeReadStream

 /**
  * Remove the read event listener for the given stream.
  *
  * @param stream $stream The PHP stream resource.
  */
 public function removeReadStream($stream)
 {
     $this->emit('removeReadStream', [$stream]);
     $this->loop->removeReadStream($stream);
 }
开发者ID:WyriHaximus,项目名称:reactphp-event-loop-inspector,代码行数:10,代码来源:LoopDecorator.php


注:本文中的React\EventLoop\LoopInterface::removeReadStream方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。