private function commit(RpcCommand $x, $send = true)
 {
     if (array_pop($this->stack) !== $x) {
         throw new IllegalStateException('Did not pop expected command');
     }
     $x->clear();
     $sb = $this->commandBuffers->remove($x);
     assert(!is_null($sb));
     if (!empty($this->stack)) {
         $this->currentBuffer = $this->commandBuffers->get(array_peek($this->stack));
         assert(!is_null($this->currentBuffer));
     } else {
         $this->currentBuffer = null;
     }
     if ($send) {
         try {
             $this->parent->send($sb);
         } catch (SerializationException $e) {
             error_log($e->getMessage());
             exit(-1);
         }
     } else {
         $this->pushBuffer($sb);
     }
 }
Exemplo n.º 2
0
 protected function doAccept(RpcCommand $x)
 {
     $x->traverse($this, new NullContext());
 }