Updated pingClockTimeout to account for adjustments in client keep alive settings value.

Changed the default value for the client keep alive variable back to 1 (since that is what the setting is if the value is not found in the configuration ini file).
This commit is contained in:
woogerboy21 2015-07-30 16:38:02 -04:00
parent 8c7301b19f
commit eb9ca58fd0
5 changed files with 102 additions and 92 deletions

View file

@ -274,7 +274,7 @@ bool Servatrice::initServer()
maxGameInactivityTime = settingsCache->value("game/max_game_inactivity_time", 120).toInt();
maxPlayerInactivityTime = settingsCache->value("server/max_player_inactivity_time", 15).toInt();
pingClockInterval = settingsCache->value("server/clientkeepalive", 1).toInt();
maxUsersPerAddress = settingsCache->value("security/max_users_per_address", 4).toInt();
messageCountingInterval = settingsCache->value("security/message_counting_interval", 10).toInt();
maxMessageCountPerInterval = settingsCache->value("security/max_message_count_per_interval", 15).toInt();
@ -343,10 +343,9 @@ bool Servatrice::initServer()
return false;
}
int clientkeepalive = settingsCache->value("server/clientkeepalive", 1).toInt();
pingClock = new QTimer(this);
connect(pingClock, SIGNAL(timeout()), this, SIGNAL(pingClockTimeout()));
pingClock->start(clientkeepalive * 1000);
pingClock->start(pingClockInterval * 1000);
int statusUpdateTime = settingsCache->value("server/statusupdate", 15000).toInt();
statusUpdateClock = new QTimer(this);

View file

@ -83,7 +83,7 @@ public:
QHostAddress address;
int gamePort;
int controlPort;
ServerProperties(int _id, const QSslCertificate &_cert, const QString &_hostname, const QHostAddress &_address, int _gamePort, int _controlPort)
: id(_id), cert(_cert), hostname(_hostname), address(_address), gamePort(_gamePort), controlPort(_controlPort) { }
};
@ -115,17 +115,17 @@ private:
QMutex txBytesMutex, rxBytesMutex;
quint64 txBytes, rxBytes;
int maxGameInactivityTime, maxPlayerInactivityTime;
int maxUsersPerAddress, messageCountingInterval, maxMessageCountPerInterval, maxMessageSizePerInterval, maxGamesPerUser, commandCountingInterval, maxCommandCountPerInterval;
int maxUsersPerAddress, messageCountingInterval, maxMessageCountPerInterval, maxMessageSizePerInterval, maxGamesPerUser, commandCountingInterval, maxCommandCountPerInterval, pingClockInterval;
QString shutdownReason;
int shutdownMinutes;
QTimer *shutdownTimer;
bool isFirstShutdownMessage;
mutable QMutex serverListMutex;
QList<ServerProperties> serverList;
void updateServerList();
QMap<int, IslInterface *> islInterfaces;
public slots:
void scheduleShutdown(const QString &reason, int minutes);
@ -137,6 +137,7 @@ public:
QString getServerName() const { return serverName; }
QString getLoginMessage() const { QMutexLocker locker(&loginMessageMutex); return loginMessage; }
bool getGameShouldPing() const { return true; }
int getPingClockInterval() const { return pingClockInterval; }
int getMaxGameInactivityTime() const { return maxGameInactivityTime; }
int getMaxPlayerInactivityTime() const { return maxPlayerInactivityTime; }
int getMaxUsersPerAddress() const { return maxUsersPerAddress; }
@ -154,7 +155,7 @@ public:
void incTxBytes(quint64 num);
void incRxBytes(quint64 num);
void addDatabaseInterface(QThread *thread, Servatrice_DatabaseInterface *databaseInterface);
bool islConnectionExists(int serverId) const;
void addIslInterface(int serverId, IslInterface *interface);
void removeIslInterface(int serverId);