示例#1
0
 /**
  * Find descriptors with UdpClientSocket and return them as result
  *
  * @param RequestDescriptor[] $requestDescriptors List of all requestDescriptors
  *
  * @return RequestDescriptor[] List of udp "clients"
  */
 private function findConnectionLessSockets(array $requestDescriptors)
 {
     $result = [];
     $specification = new ConnectionLessSocketSpecification();
     foreach ($requestDescriptors as $operation) {
         if ($specification->isSatisfiedBy($operation)) {
             $result[] = $operation;
         }
     }
     return $result;
 }
 /**
  * Setup libevent for given operation
  *
  * @param RequestDescriptor $descriptor Metadata object
  * @param int|null          $timeout Timeout in seconds
  *
  * @return void
  */
 private function setupEvent(RequestDescriptor $descriptor, $timeout)
 {
     $specification = new ConnectionLessSocketSpecification();
     if (!$specification->isSatisfiedBy($descriptor)) {
         $this->delayStage->processStage([$descriptor]);
         $event = new LeEvent($this, $descriptor, $timeout);
         $this->base->addEvent($event);
     } else {
         if ($this->delayStage->processStage([$descriptor])) {
             $this->onEvent($descriptor, LeCallbackInterface::EVENT_READ);
         }
     }
 }