Make small delay which prevents auto-kick from occurring configurable.
This commit is contained in:
@@ -50,7 +50,7 @@ ConfigFile::ConfigFile(char *argv0, bool readonly) : noWriteAccess(readonly)
|
||||
myConfigState = OK;
|
||||
|
||||
// !!!! Revisionsnummer der Configdefaults !!!!!
|
||||
configRev = 87;
|
||||
configRev = 88;
|
||||
|
||||
//standard defaults
|
||||
logOnOffDefault = "1";
|
||||
@@ -201,6 +201,7 @@ ConfigFile::ConfigFile(char *argv0, bool readonly) : noWriteAccess(readonly)
|
||||
configList.push_back(ConfigInfo("ServerPutAvatarsAddress", CONFIG_TYPE_STRING, ""));
|
||||
configList.push_back(ConfigInfo("ServerPutAvatarsUser", CONFIG_TYPE_STRING, ""));
|
||||
configList.push_back(ConfigInfo("ServerPutAvatarsPassword", CONFIG_TYPE_STRING, ""));
|
||||
configList.push_back(ConfigInfo("ServerDoNotAutoKickSmallDelaySec", CONFIG_TYPE_STRING, "10"));
|
||||
configList.push_back(ConfigInfo("InternetServerConfigMode", CONFIG_TYPE_INT, "0"));
|
||||
configList.push_back(ConfigInfo("InternetServerListAddress", CONFIG_TYPE_STRING, "pokerth.net/serverlist.xml.z"));
|
||||
configList.push_back(ConfigInfo("InternetServerAddress", CONFIG_TYPE_STRING, "pokerth.6dns.org"));
|
||||
|
||||
@@ -33,6 +33,7 @@
|
||||
#include <game.h>
|
||||
#include <localenginefactory.h>
|
||||
#include <tools.h>
|
||||
#include <configfile.h>
|
||||
|
||||
|
||||
#define SERVER_CHECK_VOTE_KICK_INTERVAL_MSEC 500
|
||||
@@ -50,8 +51,8 @@ ServerGame::ServerGame(boost::shared_ptr<ServerLobbyThread> lobbyThread, u_int32
|
||||
: m_adminPlayerId(adminPlayerId), m_lobbyThread(lobbyThread), m_gui(gui),
|
||||
m_gameData(gameData), m_curState(NULL), m_id(id), m_dbId(DB_ID_INVALID), m_name(name),
|
||||
m_password(pwd), m_playerConfig(playerConfig), m_gameNum(1), m_curPetitionId(1),
|
||||
m_voteKickTimer(lobbyThread->GetIOService()), m_stateTimer1(lobbyThread->GetIOService()),
|
||||
m_stateTimer2(lobbyThread->GetIOService())
|
||||
m_doNotAutoKickSmallDelaySec(10), m_voteKickTimer(lobbyThread->GetIOService()),
|
||||
m_stateTimer1(lobbyThread->GetIOService()), m_stateTimer2(lobbyThread->GetIOService())
|
||||
{
|
||||
LOG_VERBOSE("Game object " << GetId() << " created.");
|
||||
|
||||
@@ -66,6 +67,7 @@ ServerGame::~ServerGame()
|
||||
void
|
||||
ServerGame::Init()
|
||||
{
|
||||
m_doNotAutoKickSmallDelaySec = m_playerConfig->readConfigInt("ServerDoNotAutoKickSmallDelaySec");
|
||||
m_voteKickTimer.expires_from_now(
|
||||
boost::posix_time::milliseconds(SERVER_CHECK_VOTE_KICK_INTERVAL_MSEC));
|
||||
m_voteKickTimer.async_wait(
|
||||
@@ -911,6 +913,12 @@ ServerGame::GetReceiver()
|
||||
return *m_receiver;
|
||||
}
|
||||
|
||||
unsigned
|
||||
ServerGame::GetSmallDelaySec() const
|
||||
{
|
||||
return m_doNotAutoKickSmallDelaySec;
|
||||
}
|
||||
|
||||
Game &
|
||||
ServerGame::GetGame()
|
||||
{
|
||||
|
||||
@@ -1360,7 +1360,7 @@ ServerGameStateWaitPlayerAction::TimerTimeout(const boost::system::error_code &e
|
||||
curPlayer->incrementActionTimeoutCounter();
|
||||
|
||||
if (server->GetGameData().gameType == GAME_TYPE_RANKING
|
||||
&& server->GetGameData().playerActionTimeoutSec >= 10)
|
||||
&& server->GetGameData().playerActionTimeoutSec >= server->GetSmallDelaySec())
|
||||
{
|
||||
if (curPlayer->getActionTimeoutCounter() == SERVER_WARNING_ACTION_TIMEOUT_THRESHOLD)
|
||||
{
|
||||
|
||||
@@ -86,6 +86,8 @@ public:
|
||||
void RemovePlayerInvitation(unsigned playerId);
|
||||
bool IsPlayerInvited(unsigned playerId) const;
|
||||
|
||||
unsigned GetSmallDelaySec() const;
|
||||
|
||||
// should be protected, but is needed in function.
|
||||
const Game &GetGame() const;
|
||||
Game &GetGame();
|
||||
@@ -188,6 +190,7 @@ private:
|
||||
ConfigFile *m_playerConfig;
|
||||
unsigned m_gameNum;
|
||||
unsigned m_curPetitionId;
|
||||
unsigned m_doNotAutoKickSmallDelaySec;
|
||||
boost::asio::deadline_timer m_voteKickTimer;
|
||||
boost::asio::deadline_timer m_stateTimer1;
|
||||
boost::asio::deadline_timer m_stateTimer2;
|
||||
|
||||
Reference in New Issue
Block a user