Fixed space/tabing issues.

This commit is contained in:
woogerboy21 2015-08-07 22:32:39 -04:00
parent bc99024e4f
commit af237c7d07
2 changed files with 82 additions and 82 deletions

View file

@ -43,126 +43,126 @@ class ServerSocketInterface;
class IslInterface; class IslInterface;
class Servatrice_GameServer : public QTcpServer { class Servatrice_GameServer : public QTcpServer {
Q_OBJECT Q_OBJECT
private: private:
Servatrice *server; Servatrice *server;
QList<Servatrice_ConnectionPool *> connectionPools; QList<Servatrice_ConnectionPool *> connectionPools;
public: public:
Servatrice_GameServer(Servatrice *_server, int _numberPools, const QSqlDatabase &_sqlDatabase, QObject *parent = 0); Servatrice_GameServer(Servatrice *_server, int _numberPools, const QSqlDatabase &_sqlDatabase, QObject *parent = 0);
~Servatrice_GameServer(); ~Servatrice_GameServer();
protected: protected:
#if QT_VERSION < 0x050000 #if QT_VERSION < 0x050000
void incomingConnection(int socketDescriptor); void incomingConnection(int socketDescriptor);
#else #else
void incomingConnection(qintptr socketDescriptor); void incomingConnection(qintptr socketDescriptor);
#endif #endif
}; };
class Servatrice_IslServer : public QTcpServer { class Servatrice_IslServer : public QTcpServer {
Q_OBJECT Q_OBJECT
private: private:
Servatrice *server; Servatrice *server;
QSslCertificate cert; QSslCertificate cert;
QSslKey privateKey; QSslKey privateKey;
public: public:
Servatrice_IslServer(Servatrice *_server, const QSslCertificate &_cert, const QSslKey &_privateKey, QObject *parent = 0) Servatrice_IslServer(Servatrice *_server, const QSslCertificate &_cert, const QSslKey &_privateKey, QObject *parent = 0)
: QTcpServer(parent), server(_server), cert(_cert), privateKey(_privateKey) { } : QTcpServer(parent), server(_server), cert(_cert), privateKey(_privateKey) { }
protected: protected:
#if QT_VERSION < 0x050000 #if QT_VERSION < 0x050000
void incomingConnection(int socketDescriptor); void incomingConnection(int socketDescriptor);
#else #else
void incomingConnection(qintptr socketDescriptor); void incomingConnection(qintptr socketDescriptor);
#endif #endif
}; };
class ServerProperties { class ServerProperties {
public: public:
int id; int id;
QSslCertificate cert; QSslCertificate cert;
QString hostname; QString hostname;
QHostAddress address; QHostAddress address;
int gamePort; int gamePort;
int controlPort; int controlPort;
ServerProperties(int _id, const QSslCertificate &_cert, const QString &_hostname, const 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) { } : id(_id), cert(_cert), hostname(_hostname), address(_address), gamePort(_gamePort), controlPort(_controlPort) { }
}; };
class Servatrice : public Server class Servatrice : public Server
{ {
Q_OBJECT Q_OBJECT
public: public:
enum AuthenticationMethod { AuthenticationNone, AuthenticationSql, AuthenticationPassword }; enum AuthenticationMethod { AuthenticationNone, AuthenticationSql, AuthenticationPassword };
private slots: private slots:
void statusUpdate(); void statusUpdate();
void shutdownTimeout(); void shutdownTimeout();
protected: protected:
void doSendIslMessage(const IslMessage &msg, int serverId); void doSendIslMessage(const IslMessage &msg, int serverId);
private: private:
enum DatabaseType { DatabaseNone, DatabaseMySql }; enum DatabaseType { DatabaseNone, DatabaseMySql };
AuthenticationMethod authenticationMethod; AuthenticationMethod authenticationMethod;
DatabaseType databaseType; DatabaseType databaseType;
QTimer *pingClock, *statusUpdateClock; QTimer *pingClock, *statusUpdateClock;
Servatrice_GameServer *gameServer; Servatrice_GameServer *gameServer;
Servatrice_IslServer *islServer; Servatrice_IslServer *islServer;
QString serverName; QString serverName;
mutable QMutex loginMessageMutex; mutable QMutex loginMessageMutex;
QString loginMessage; QString loginMessage;
QString dbPrefix; QString dbPrefix;
Servatrice_DatabaseInterface *servatriceDatabaseInterface; Servatrice_DatabaseInterface *servatriceDatabaseInterface;
int serverId; int serverId;
int uptime; int uptime;
QMutex txBytesMutex, rxBytesMutex; QMutex txBytesMutex, rxBytesMutex;
quint64 txBytes, rxBytes; quint64 txBytes, rxBytes;
int maxGameInactivityTime, maxPlayerInactivityTime; int maxGameInactivityTime, maxPlayerInactivityTime;
int maxUsersPerAddress, messageCountingInterval, maxMessageCountPerInterval, maxMessageSizePerInterval, maxGamesPerUser, commandCountingInterval, maxCommandCountPerInterval, pingClockInterval; int maxUsersPerAddress, messageCountingInterval, maxMessageCountPerInterval, maxMessageSizePerInterval, maxGamesPerUser, commandCountingInterval, maxCommandCountPerInterval, pingClockInterval;
QString shutdownReason; QString shutdownReason;
int shutdownMinutes; int shutdownMinutes;
QTimer *shutdownTimer; QTimer *shutdownTimer;
bool isFirstShutdownMessage, clientIdRequired; bool isFirstShutdownMessage, clientIdRequired;
mutable QMutex serverListMutex; mutable QMutex serverListMutex;
QList<ServerProperties> serverList; QList<ServerProperties> serverList;
void updateServerList(); void updateServerList();
QMap<int, IslInterface *> islInterfaces; QMap<int, IslInterface *> islInterfaces;
public slots: public slots:
void scheduleShutdown(const QString &reason, int minutes); void scheduleShutdown(const QString &reason, int minutes);
void updateLoginMessage(); void updateLoginMessage();
public: public:
Servatrice(QObject *parent = 0); Servatrice(QObject *parent = 0);
~Servatrice(); ~Servatrice();
bool initServer(); bool initServer();
QString getServerName() const { return serverName; } QString getServerName() const { return serverName; }
QString getLoginMessage() const { QMutexLocker locker(&loginMessageMutex); return loginMessage; } QString getLoginMessage() const { QMutexLocker locker(&loginMessageMutex); return loginMessage; }
bool getGameShouldPing() const { return true; } bool getGameShouldPing() const { return true; }
bool getClientIdRequired() const { return clientIdRequired; } bool getClientIdRequired() const { return clientIdRequired; }
int getPingClockInterval() const { return pingClockInterval; } int getPingClockInterval() const { return pingClockInterval; }
int getMaxGameInactivityTime() const { return maxGameInactivityTime; } int getMaxGameInactivityTime() const { return maxGameInactivityTime; }
int getMaxPlayerInactivityTime() const { return maxPlayerInactivityTime; } int getMaxPlayerInactivityTime() const { return maxPlayerInactivityTime; }
int getMaxUsersPerAddress() const { return maxUsersPerAddress; } int getMaxUsersPerAddress() const { return maxUsersPerAddress; }
int getMessageCountingInterval() const { return messageCountingInterval; } int getMessageCountingInterval() const { return messageCountingInterval; }
int getMaxMessageCountPerInterval() const { return maxMessageCountPerInterval; } int getMaxMessageCountPerInterval() const { return maxMessageCountPerInterval; }
int getMaxMessageSizePerInterval() const { return maxMessageSizePerInterval; } int getMaxMessageSizePerInterval() const { return maxMessageSizePerInterval; }
int getMaxGamesPerUser() const { return maxGamesPerUser; } int getMaxGamesPerUser() const { return maxGamesPerUser; }
int getCommandCountingInterval() const { return commandCountingInterval; } int getCommandCountingInterval() const { return commandCountingInterval; }
int getMaxCommandCountPerInterval() const { return maxCommandCountPerInterval; } int getMaxCommandCountPerInterval() const { return maxCommandCountPerInterval; }
AuthenticationMethod getAuthenticationMethod() const { return authenticationMethod; } AuthenticationMethod getAuthenticationMethod() const { return authenticationMethod; }
QString getDbPrefix() const { return dbPrefix; } QString getDbPrefix() const { return dbPrefix; }
int getServerId() const { return serverId; } int getServerId() const { return serverId; }
int getUsersWithAddress(const QHostAddress &address) const; int getUsersWithAddress(const QHostAddress &address) const;
QList<ServerSocketInterface *> getUsersWithAddressAsList(const QHostAddress &address) const; QList<ServerSocketInterface *> getUsersWithAddressAsList(const QHostAddress &address) const;
void incTxBytes(quint64 num); void incTxBytes(quint64 num);
void incRxBytes(quint64 num); void incRxBytes(quint64 num);
void addDatabaseInterface(QThread *thread, Servatrice_DatabaseInterface *databaseInterface); void addDatabaseInterface(QThread *thread, Servatrice_DatabaseInterface *databaseInterface);
bool islConnectionExists(int serverId) const; bool islConnectionExists(int serverId) const;
void addIslInterface(int serverId, IslInterface *interface); void addIslInterface(int serverId, IslInterface *interface);
void removeIslInterface(int serverId); void removeIslInterface(int serverId);
QReadWriteLock islLock; QReadWriteLock islLock;
QList<ServerProperties> getServerList() const; QList<ServerProperties> getServerList() const;
}; };
#endif #endif