remove() public static method

Removes timer by ID
public static remove ( integer | string $id ) : void
$id integer | string Timer ID
return void
Exemplo n.º 1
0
 /**
  * @TODO DESCR
  */
 public function onFinish()
 {
     if ($this->attachedServer) {
         $this->attachedServer->attachedClients->detach($this);
     }
     Timer::remove($this->keepaliveTimer);
     parent::onFinish();
 }
Exemplo n.º 2
0
 /**
  * Called when session finishes
  * @return void
  */
 public function onFinish()
 {
     parent::onFinish();
     $this->event('disconnect');
     if (isset($this->xml)) {
         $this->xml->finish();
     }
     unset($this->roster);
     if ($this->keepaliveTimer) {
         Timer::remove($this->keepaliveTimer);
     }
 }
Exemplo n.º 3
0
 /**
  * @TODO DESCR
  * @return void
  */
 public function onFinish()
 {
     if ($this->onFinishedCalled) {
         return;
     }
     $this->onFinishedCalled = true;
     $this->appInstance->unsubscribe('c2s:' . $this->id, [$this, 'c2s']);
     $this->appInstance->unsubscribe('poll:' . $this->id, [$this, 'poll']);
     if (isset($this->route)) {
         $this->route->onFinish();
     }
     $this->onWrite->reset();
     $this->route = null;
     Timer::remove($this->finishTimer);
     $this->appInstance->endSession($this);
 }
Exemplo n.º 4
0
 /**
  * Called when connection is finished
  * @return void
  */
 public function onFinish()
 {
     Timer::remove($this->keepaliveTimer);
     if ($this->req !== null && $this->req instanceof Generic) {
         if (!$this->req->isFinished()) {
             $this->req->abort();
         }
     }
     $this->req = null;
 }
Exemplo n.º 5
0
 /**
  * Shutdown this worker
  * @param boolean Hard? If hard, we shouldn't wait for graceful shutdown of the running applications.
  * @return boolean|null Ready?
  */
 protected function shutdown($hard = false)
 {
     $error = error_get_last();
     if ($error) {
         if ($error['type'] === E_ERROR) {
             Daemon::log('W#' . $this->pid . ' crashed by error \'' . $error['message'] . '\' at ' . $error['file'] . ':' . $error['line']);
         }
     }
     if (Daemon::$config->logevents->value) {
         $this->log('event shutdown(' . ($hard ? 'HARD' : '') . ') invoked.');
     }
     if (Daemon::$config->throwexceptiononshutdown->value) {
         throw new \Exception('event shutdown');
     }
     @ob_flush();
     if ($this->terminated === true) {
         if ($hard) {
             exit(0);
         }
         return;
     }
     $this->terminated = true;
     if ($hard) {
         $this->setState(Daemon::WSTATE_SHUTDOWN);
         exit(0);
     }
     $this->reloadReady = $this->appInstancesReloadReady();
     if ($this->reload && $this->graceful) {
         $this->reloadReady = $this->reloadReady && microtime(TRUE) > $this->reloadTime;
     }
     if (Daemon::$config->logevents->value) {
         $this->log('reloadReady = ' . Debug::dump($this->reloadReady));
     }
     Timer::remove('breakMainLoopCheck');
     Timer::add(function ($event) {
         $self = Daemon::$process;
         $self->reloadReady = $self->appInstancesReloadReady();
         if ($self->reload === TRUE) {
             $self->reloadReady = $self->reloadReady && microtime(TRUE) > $self->reloadTime;
         }
         if (!$self->reloadReady) {
             $event->timeout();
         } else {
             $self->eventBase->exit();
         }
     }, 1000000.0, 'checkReloadReady');
     while (!$this->reloadReady) {
         $this->eventBase->loop();
     }
     FileSystem::waitAllEvents();
     // ensure that all I/O events completed before suicide
     exit(0);
     // R.I.P.
 }
Exemplo n.º 6
0
 function clearTimeout($id)
 {
     \PHPDaemon\Core\Timer::remove($id);
 }
Exemplo n.º 7
0
 /**
  * On finish
  * @return void
  */
 public function onFinish()
 {
     $this->appInstance->unsubscribe('s2c:' . $this->sessId, [$this, 's2c']);
     $this->appInstance->unsubscribe('w8in:' . $this->sessId, [$this, 'w8in']);
     Timer::remove($this->heartbeatTimer);
     if ($this->heartbeatOnFinish) {
         $this->sendFrame('h');
     }
     parent::onFinish();
 }
Exemplo n.º 8
0
 /**
  * @TODO DESCR
  * @return void
  */
 public function onFinish()
 {
     Timer::remove($this->heartbeatTimer);
     if ($this->realRoute) {
         $this->realRoute->onFinish();
         $this->realRoute = null;
     }
 }
 /**
  * @see \FutoIn\RI\Details\AsyncToolImpl::cancelCall
  */
 public function cancelCall($ref)
 {
     \PHPDaemon\Core\Timer::remove($ref->id);
 }