Exemplo n.º 1
0
 /**
  * Waits until some data is retrieved from the socket.
  *
  * PhpAmqpLib_Exception_AMQPTimeoutException can be raised if the timeout is set
  *
  * @throws PhpAmqpLib_Exception_AMQPTimeoutException
  */
 protected function wait()
 {
     if ($this->timeout == 0) {
         return;
     }
     // wait ..
     list($sec, $usec) = PhpAmqpLib_Helper_MiscHelper::splitSecondsMicroseconds($this->timeout);
     $result = $this->io->select($sec, $usec);
     if ($result === false) {
         throw new PhpAmqpLib_Exception_AMQPRuntimeException('A network error occured while awaiting for incoming data');
     }
     if ($result === 0) {
         throw new PhpAmqpLib_Exception_AMQPTimeoutException(sprintf('The connection timed out after %s sec while awaiting incoming data', $this->getTimeout()));
     }
 }