unregisterInterface() public method

public unregisterInterface ( pocketmine\network\SourceInterface $interface )
$interface pocketmine\network\SourceInterface
コード例 #1
0
 public function doTick()
 {
     if (!$this->rakLib->isTerminated()) {
         $this->interface->sendTick();
     } else {
         $info = $this->rakLib->getTerminationInfo();
         $this->network->unregisterInterface($this);
         \ExceptionHandler::handler(E_ERROR, "RakLib Thread crashed [" . $info["scope"] . "]: " . (isset($info["message"]) ? $info["message"] : ""), $info["file"], $info["line"]);
     }
 }
コード例 #2
0
 public function process()
 {
     $work = false;
     if ($this->interface->handlePacket()) {
         $work = true;
         while ($this->interface->handlePacket()) {
         }
     }
     if ($this->rakLib->isTerminated()) {
         $this->network->unregisterInterface($this);
         throw new \Exception("RakLib Thread crashed");
     }
     return $work;
 }
コード例 #3
0
 public function process()
 {
     $work = false;
     if ($this->interface->handlePacket()) {
         $work = true;
         while ($this->interface->handlePacket()) {
         }
     }
     if ($this->rakLib->isTerminated()) {
         $info = $this->rakLib->getTerminationInfo();
         $this->network->unregisterInterface($this);
         \ExceptionHandler::handler(E_ERROR, "RakLib Thread crashed [" . $info["scope"] . "]: " . (isset($info["message"]) ? $info["message"] : ""), $info["file"], $info["line"]);
     }
     return $work;
 }
コード例 #4
0
 public function process()
 {
     $work = false;
     if ($this->interface->handlePacket()) {
         $work = true;
         if ($this->timeout < 0) {
             while ($this->interface->handlePacket()) {
             }
         } else {
             $timestamp = time();
             while ($this->interface->handlePacket()) {
                 if (time() - $timestamp >= $this->timeout) {
                     break;
                 }
             }
         }
     }
     if ($this->rakLib->isTerminated()) {
         $this->network->unregisterInterface($this);
         throw new \Exception("A RakLib Thread crashed!");
     }
     return $work;
 }
コード例 #5
0
ファイル: Server.php プロジェクト: ZenaGamingsky/PocketBox
 public function forceShutdown()
 {
     if ($this->hasStopped) {
         return;
     }
     try {
         if (!$this->isRunning()) {
             $this->sendUsage(SendUsageTask::TYPE_CLOSE);
         }
         $this->hasStopped = true;
         $this->shutdown();
         if ($this->rcon instanceof RCON) {
             $this->rcon->stop();
         }
         if ($this->getProperty("network.upnp-forwarding", false) === true) {
             $this->logger->info("[UPnP] Removing port forward...");
             UPnP::RemovePortForward($this->getPort());
         }
         $this->getLogger()->debug("Disabling all plugins");
         $this->pluginManager->disablePlugins();
         foreach ($this->players as $player) {
             $player->close($player->getLeaveMessage(), $this->getProperty("settings.shutdown-message", "Server closed"));
         }
         $this->getLogger()->debug("Unloading all levels");
         foreach ($this->getLevels() as $level) {
             $this->unloadLevel($level, true);
         }
         $this->getLogger()->debug("Removing event handlers");
         HandlerList::unregisterAll();
         $this->getLogger()->debug("Stopping all tasks");
         $this->scheduler->cancelAllTasks();
         $this->scheduler->mainThreadHeartbeat(PHP_INT_MAX);
         $this->getLogger()->debug("Saving properties");
         $this->properties->save();
         $this->getLogger()->debug("Closing console");
         $this->console->kill();
         $this->getLogger()->debug("Stopping network interfaces");
         foreach ($this->network->getInterfaces() as $interface) {
             $interface->shutdown();
             $this->network->unregisterInterface($interface);
         }
         $this->memoryManager->doObjectCleanup();
         gc_collect_cycles();
     } catch (\Exception $e) {
         $this->logger->emergency("Crashed while crashing, killing process");
         @kill(getmypid());
     }
 }
コード例 #6
0
ファイル: Server.php プロジェクト: ZenaGamingsky/Steadfast2
 public function forceShutdown()
 {
     if ($this->hasStopped) {
         return;
     }
     try {
         $this->hasStopped = true;
         $this->shutdown();
         if ($this->rcon instanceof RCON) {
             $this->rcon->stop();
         }
         if ($this->getProperty("settings.upnp-forwarding", false) === true) {
             $this->logger->info("[UPnP] Removing port forward...");
             UPnP::RemovePortForward($this->getPort());
         }
         $this->pluginManager->disablePlugins();
         foreach ($this->players as $player) {
             $player->close(TextFormat::YELLOW . $player->getName() . " has left the game", $this->getProperty("settings.shutdown-message", "Server closed"));
         }
         foreach ($this->getLevels() as $level) {
             $this->unloadLevel($level, true);
         }
         if ($this->generationManager instanceof GenerationRequestManager) {
             $this->generationManager->shutdown();
         }
         HandlerList::unregisterAll();
         $this->scheduler->cancelAllTasks();
         $this->scheduler->mainThreadHeartbeat(PHP_INT_MAX);
         $this->properties->save();
         $this->console->kill();
         foreach ($this->network->getInterfaces() as $interface) {
             $interface->shutdown();
             $this->network->unregisterInterface($interface);
         }
     } catch (\Exception $e) {
         $this->logger->emergency("Crashed while crashing, killing process");
         @kill(getmypid());
     }
 }
コード例 #7
0
ファイル: Server.php プロジェクト: TDMGamingMC/PocketMine-MP
 public function forceShutdown()
 {
     if ($this->hasStopped) {
         return;
     }
     try {
         $this->hasStopped = true;
         $this->shutdown();
         if ($this->rcon instanceof RCON) {
             $this->rcon->stop();
         }
         if ($this->getProperty("network.upnp-forwarding", false) === true) {
             $this->katana->console->system("[UPnP] Removing port forward...");
             UPnP::RemovePortForward($this->getPort());
         }
         $this->katana->console->system(Terminal::$COLOR_GRAY . "Disabling all plugins");
         $this->pluginManager->disablePlugins();
         foreach ($this->players as $player) {
             $player->close($player->getLeaveMessage(), $this->getProperty("settings.shutdown-message", "Server closed"));
         }
         $this->katana->console->system(Terminal::$COLOR_GRAY . "Unloading all levels");
         foreach ($this->getLevels() as $level) {
             $this->unloadLevel($level, true);
         }
         $this->katana->console->system("Removing event handlers");
         HandlerList::unregisterAll();
         $this->katana->console->system("Saving properties");
         $this->properties->save();
         $this->katana->console->system("Closing console");
         $this->console->kill();
         $this->katana->console->system("Stopping network interfaces");
         foreach ($this->network->getInterfaces() as $interface) {
             $interface->shutdown();
             $this->network->unregisterInterface($interface);
         }
         $this->memoryManager->doObjectCleanup();
         gc_collect_cycles();
     } catch (\Exception $e) {
         $this->logger->emergency("Crashed while crashing, killing process");
         @kill(getmypid());
     }
 }