Enable kick-idle-player-seconds only for WAN server

This commit is contained in:
Benau 2018-12-06 01:14:01 +08:00
parent 3d64340137
commit 6be39f7ef8
3 changed files with 5 additions and 2 deletions

View File

@ -610,7 +610,8 @@ void ServerLobby::asynchronousUpdate()
void ServerLobby::update(int ticks)
{
int sec = ServerConfig::m_kick_idle_player_seconds;
if (sec > 0 && m_state.load() >= WAIT_FOR_WORLD_LOADED &&
if (NetworkConfig::get()->isWAN() &&
sec > 0 && m_state.load() >= WAIT_FOR_WORLD_LOADED &&
m_state.load() <= RACING && m_server_has_loaded_world.load() == true)
{
auto players = m_game_setup->getConnectedPlayers(true/*same_offset*/);

View File

@ -291,7 +291,8 @@ namespace ServerConfig
"kick-idle-player-seconds",
"Kick idle player which has no network activity to server for more "
"than some seconds during game, unless he has finished the race. "
"Negative value to disable."));
"Negative value to disable, and this option will always be disabled "
"for LAN server."));
SERVER_CFG_PREFIX StringToUIntServerConfigParam m_server_ip_ban_list
SERVER_CFG_DEFAULT(StringToUIntServerConfigParam("server-ip-ban-list",

View File

@ -768,6 +768,7 @@ void STKHost::mainLoop()
" than %d ms, kick.",
p.second->getAddress().toString().c_str(),
ap, max_ping);
p.second->setWarnedForHighPing(true);
p.second->setDisconnected(true);
std::lock_guard<std::mutex> lock(m_enet_cmd_mutex);
m_enet_cmd.emplace_back(p.second->getENetPeer(),