From bc675ffd815cb36e73616ce1185792a9bf7dfd26 Mon Sep 17 00:00:00 2001 From: Deve Date: Wed, 19 Sep 2018 22:06:41 +0200 Subject: [PATCH] Revert "Disconnect android player from wan race when the window is not active anymore" This reverts commit e80e0555e1fbb51ee82c1db816009c9391f9a68e. --- src/guiengine/event_handler.cpp | 17 ----------------- src/network/stk_host.cpp | 1 - src/network/stk_host.hpp | 22 +--------------------- 3 files changed, 1 insertion(+), 39 deletions(-) diff --git a/src/guiengine/event_handler.cpp b/src/guiengine/event_handler.cpp index be50ca5f6..cf21b957c 100644 --- a/src/guiengine/event_handler.cpp +++ b/src/guiengine/event_handler.cpp @@ -34,8 +34,6 @@ #include "input/input_manager.hpp" #include "modes/demo_world.hpp" #include "modes/world.hpp" -#include "network/network_config.hpp" -#include "network/stk_host.hpp" #include "states_screens/state_manager.hpp" #include "utils/debug.hpp" #include "utils/profiler.hpp" @@ -186,21 +184,6 @@ bool EventHandler::OnEvent (const SEvent &event) SFXManager::get()->resumeAll(); } } - else if (cmd == APP_CMD_TERM_WINDOW) - { - if (STKHost::existHost() && NetworkConfig::get()->isWAN()) - { - STKHost::get()->requestShutdownDelayed(10000); - } - } - else if (cmd == APP_CMD_INIT_WINDOW) - { - if (STKHost::existHost() && NetworkConfig::get()->isWAN() && - !STKHost::get()->requestedShutdown()) - { - STKHost::get()->cancelShutdown(); - } - } else if (cmd == APP_CMD_LOW_MEMORY) { Log::warn("EventHandler", "Low memory event received"); diff --git a/src/network/stk_host.cpp b/src/network/stk_host.cpp index 784ded4c0..10f7ede5c 100644 --- a/src/network/stk_host.cpp +++ b/src/network/stk_host.cpp @@ -308,7 +308,6 @@ void STKHost::init() { m_network_timer.store(StkTime::getRealTimeMs()); m_shutdown = false; - m_shutdown_delay = 0; m_authorised = false; m_network = NULL; m_exit_timeout.store(std::numeric_limits::max()); diff --git a/src/network/stk_host.hpp b/src/network/stk_host.hpp index e8b618e39..18e6fa6d6 100644 --- a/src/network/stk_host.hpp +++ b/src/network/stk_host.hpp @@ -117,9 +117,6 @@ private: * triggers a shutdown of the STKHost (and the Protocolmanager). */ std::atomic_bool m_shutdown; - /** Used as a timeout for shedule shutdown. */ - std::atomic m_shutdown_delay; - /** True if this local host is authorised to control a server. */ std::atomic_bool m_authorised; @@ -211,21 +208,8 @@ public: void requestShutdown() { m_shutdown.store(true); - m_shutdown_delay.store(0); } // requestExit //------------------------------------------------------------------------- - void requestShutdownDelayed(int delay) - { - m_shutdown.store(true); - m_shutdown_delay.store(StkTime::getRealTimeMs() + delay); - } - //------------------------------------------------------------------------- - void cancelShutdown() - { - m_shutdown.store(false); - m_shutdown_delay.store(0); - } - //------------------------------------------------------------------------- void shutdown(); //------------------------------------------------------------------------- void sendPacketToAllPeersInServer(NetworkString *data, @@ -282,11 +266,7 @@ public: // ------------------------------------------------------------------------ /** Returns true if a shutdown of the network infrastructure was * requested. */ - bool requestedShutdown() const - { - return m_shutdown.load() && - m_shutdown_delay.load() < StkTime::getRealTimeMs(); - } + bool requestedShutdown() const { return m_shutdown.load(); } // ------------------------------------------------------------------------ int receiveRawPacket(char *buffer, int buffer_len, TransportAddress* sender, int max_tries = -1)