mirror of
https://github.com/Cockatrice/Cockatrice.git
synced 2026-04-27 07:48:01 -07:00
switched NetworkServerThread to new thread creation method, SSL is working
This commit is contained in:
parent
0719d4c6ed
commit
decf1c04bd
6 changed files with 98 additions and 165 deletions
|
|
@ -25,7 +25,7 @@
|
|||
#include "server_room.h"
|
||||
#include "serversocketinterface.h"
|
||||
#include "serversocketthread.h"
|
||||
#include "networkserverthread.h"
|
||||
#include "networkserverinterface.h"
|
||||
#include "server_logger.h"
|
||||
#include "main.h"
|
||||
#include "passwordhasher.h"
|
||||
|
|
@ -50,8 +50,15 @@ void Servatrice_GameServer::incomingConnection(int socketDescriptor)
|
|||
|
||||
void Servatrice_NetworkServer::incomingConnection(int socketDescriptor)
|
||||
{
|
||||
NetworkServerThread *thread = new NetworkServerThread(socketDescriptor, server, cert, privateKey);
|
||||
QThread *thread = new QThread;
|
||||
connect(thread, SIGNAL(finished()), thread, SLOT(deleteLater()));
|
||||
|
||||
NetworkServerInterface *interface = new NetworkServerInterface(socketDescriptor, cert, privateKey, server);
|
||||
interface->moveToThread(thread);
|
||||
connect(interface, SIGNAL(destroyed()), thread, SLOT(quit()));
|
||||
|
||||
thread->start();
|
||||
QMetaObject::invokeMethod(interface, "initServer", Qt::QueuedConnection);
|
||||
}
|
||||
|
||||
Servatrice::Servatrice(QSettings *_settings, QObject *parent)
|
||||
|
|
@ -150,12 +157,15 @@ Servatrice::Servatrice(QSettings *_settings, QObject *parent)
|
|||
continue;
|
||||
}
|
||||
|
||||
NetworkServerThread *thread = new NetworkServerThread(prop.hostname, prop.address.toString(), prop.controlPort, prop.cert, this, cert, key);
|
||||
thread->start();
|
||||
QThread *thread = new QThread;
|
||||
connect(thread, SIGNAL(finished()), thread, SLOT(deleteLater()));
|
||||
|
||||
QMutex initMutex;
|
||||
initMutex.lock();
|
||||
thread->initWaitCondition.wait(&initMutex);
|
||||
NetworkServerInterface *interface = new NetworkServerInterface(prop.hostname, prop.address.toString(), prop.controlPort, prop.cert, cert, key, this);
|
||||
interface->moveToThread(thread);
|
||||
connect(interface, SIGNAL(destroyed()), thread, SLOT(quit()));
|
||||
|
||||
thread->start();
|
||||
QMetaObject::invokeMethod(interface, "initClient", Qt::BlockingQueuedConnection);
|
||||
}
|
||||
|
||||
} } catch (QString error) {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue