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