|
|
|
@ -575,6 +575,11 @@ AuthServer::AuthServer(TQObject* parent) :
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
AuthServer::~AuthServer() {
|
|
|
|
|
if (m_sqlPingTimer) {
|
|
|
|
|
m_sqlPingTimer->stop();
|
|
|
|
|
delete m_sqlPingTimer;
|
|
|
|
|
m_sqlPingTimer = NULL;
|
|
|
|
|
}
|
|
|
|
|
if (m_database) {
|
|
|
|
|
TQSqlDatabase::removeDatabase(m_database);
|
|
|
|
|
m_database = NULL;
|
|
|
|
@ -639,9 +644,24 @@ int AuthServer::connectToDatabase() {
|
|
|
|
|
return -1;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// FIXME
|
|
|
|
|
// We currently have no way to handle something as simple as the database server going offline!
|
|
|
|
|
|
|
|
|
|
// Start database ping process
|
|
|
|
|
m_sqlPingTimer = new TQTimer();
|
|
|
|
|
connect(m_sqlPingTimer, SIGNAL(timeout()), this, SLOT(pingSQLServer()));
|
|
|
|
|
m_sqlPingTimer->start(60*1000);
|
|
|
|
|
|
|
|
|
|
return 0;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void AuthServer::pingSQLServer() {
|
|
|
|
|
// FIXME
|
|
|
|
|
// We might as well gather statistics here...
|
|
|
|
|
TQSqlQuery query;
|
|
|
|
|
query.exec("SELECT * FROM activity");
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void AuthServer::newConnection(int socket) {
|
|
|
|
|
AuthSocket *s = new AuthSocket(socket, this);
|
|
|
|
|
s->m_remoteHost = s->peerAddress().toString();
|
|
|
|
|