race condition fixed
This commit is contained in:
parent
091a2ed6b2
commit
7ae0e31964
7 changed files with 3 additions and 15 deletions
|
@ -76,7 +76,6 @@ void myMessageOutput(QtMsgType /*type*/, const char *msg)
|
||||||
void sigSegvHandler(int sig)
|
void sigSegvHandler(int sig)
|
||||||
{
|
{
|
||||||
logger->logMessage("SIGSEGV");
|
logger->logMessage("SIGSEGV");
|
||||||
usleep(1000);
|
|
||||||
delete loggerThread;
|
delete loggerThread;
|
||||||
raise(sig);
|
raise(sig);
|
||||||
}
|
}
|
||||||
|
|
|
@ -30,7 +30,6 @@
|
||||||
void Servatrice_TcpServer::incomingConnection(int socketDescriptor)
|
void Servatrice_TcpServer::incomingConnection(int socketDescriptor)
|
||||||
{
|
{
|
||||||
ServerSocketThread *sst = new ServerSocketThread(socketDescriptor, server, this);
|
ServerSocketThread *sst = new ServerSocketThread(socketDescriptor, server, this);
|
||||||
connect(sst, SIGNAL(clientAdded(ServerSocketInterface *)), this, SIGNAL(clientAdded(ServerSocketInterface *)));
|
|
||||||
sst->start();
|
sst->start();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -57,7 +56,6 @@ Servatrice::Servatrice(QSettings *_settings, QObject *parent)
|
||||||
}
|
}
|
||||||
|
|
||||||
tcpServer = new Servatrice_TcpServer(this);
|
tcpServer = new Servatrice_TcpServer(this);
|
||||||
connect(tcpServer, SIGNAL(clientAdded(ServerSocketInterface *)), this, SLOT(newConnection(ServerSocketInterface *)));
|
|
||||||
int port = settings->value("server/port", 4747).toInt();
|
int port = settings->value("server/port", 4747).toInt();
|
||||||
qDebug() << "Starting server on port" << port;
|
qDebug() << "Starting server on port" << port;
|
||||||
tcpServer->listen(QHostAddress::Any, port);
|
tcpServer->listen(QHostAddress::Any, port);
|
||||||
|
@ -154,11 +152,6 @@ bool Servatrice::execSqlQuery(QSqlQuery &query)
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
void Servatrice::newConnection(ServerSocketInterface *client)
|
|
||||||
{
|
|
||||||
addClient(client);
|
|
||||||
}
|
|
||||||
|
|
||||||
AuthenticationResult Servatrice::checkUserPassword(const QString &user, const QString &password)
|
AuthenticationResult Servatrice::checkUserPassword(const QString &user, const QString &password)
|
||||||
{
|
{
|
||||||
QMutexLocker locker(&dbMutex);
|
QMutexLocker locker(&dbMutex);
|
||||||
|
|
|
@ -41,15 +41,12 @@ public:
|
||||||
: QTcpServer(parent), server(_server) { }
|
: QTcpServer(parent), server(_server) { }
|
||||||
protected:
|
protected:
|
||||||
void incomingConnection(int socketDescriptor);
|
void incomingConnection(int socketDescriptor);
|
||||||
signals:
|
|
||||||
void clientAdded(ServerSocketInterface *client);
|
|
||||||
};
|
};
|
||||||
|
|
||||||
class Servatrice : public Server
|
class Servatrice : public Server
|
||||||
{
|
{
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
private slots:
|
private slots:
|
||||||
void newConnection(ServerSocketInterface *client);
|
|
||||||
void statusUpdate();
|
void statusUpdate();
|
||||||
void updateBanTimer();
|
void updateBanTimer();
|
||||||
public:
|
public:
|
||||||
|
|
|
@ -25,6 +25,7 @@ ServerLogger::ServerLogger(const QString &logFileName, QObject *parent)
|
||||||
|
|
||||||
ServerLogger::~ServerLogger()
|
ServerLogger::~ServerLogger()
|
||||||
{
|
{
|
||||||
|
flushBuffer();
|
||||||
}
|
}
|
||||||
|
|
||||||
void ServerLogger::logMessage(QString message)
|
void ServerLogger::logMessage(QString message)
|
||||||
|
|
|
@ -54,6 +54,8 @@ ServerSocketInterface::ServerSocketInterface(Servatrice *_server, QTcpSocket *_s
|
||||||
deleteLater();
|
deleteLater();
|
||||||
} else
|
} else
|
||||||
sendProtocolItem(new Event_ServerMessage(Servatrice::versionString));
|
sendProtocolItem(new Event_ServerMessage(Servatrice::versionString));
|
||||||
|
|
||||||
|
server->addClient(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
ServerSocketInterface::~ServerSocketInterface()
|
ServerSocketInterface::~ServerSocketInterface()
|
||||||
|
|
|
@ -23,7 +23,5 @@ void ServerSocketThread::run()
|
||||||
ssi = new ServerSocketInterface(server, socket);
|
ssi = new ServerSocketInterface(server, socket);
|
||||||
connect(ssi, SIGNAL(destroyed()), this, SLOT(deleteLater()));
|
connect(ssi, SIGNAL(destroyed()), this, SLOT(deleteLater()));
|
||||||
|
|
||||||
emit clientAdded(ssi);
|
|
||||||
|
|
||||||
exec();
|
exec();
|
||||||
}
|
}
|
||||||
|
|
|
@ -17,8 +17,6 @@ public:
|
||||||
~ServerSocketThread();
|
~ServerSocketThread();
|
||||||
protected:
|
protected:
|
||||||
void run();
|
void run();
|
||||||
signals:
|
|
||||||
void clientAdded(ServerSocketInterface *client);
|
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
Loading…
Reference in a new issue