Example #1
0
 public function sendCallback($resource, $event, array $data)
 {
     /**
      * @var Stream $stream
      */
     list($eventId, $stream) = $data;
     if (Event::TIMEOUT === $event) {
         $stream->closeWithFail();
         return;
     }
     if (null === ($ret = $stream->send())) {
         return;
     }
     if (true === $ret) {
         $this->sentStreams[] = $stream->getId();
         $this->event->onRead($resource, array($this, 'receiveCallback'), $stream, $this->readTimeout);
     }
     $this->event->remove($eventId);
 }