mirror of
https://github.com/Cockatrice/Cockatrice.git
synced 2026-04-27 07:48:01 -07:00
changed a lot of thread locking code in the server, rooms are working with ISL now
This commit is contained in:
parent
572e4eaafa
commit
c23af44749
16 changed files with 449 additions and 221 deletions
|
|
@ -5,8 +5,11 @@
|
|||
#include <QStringList>
|
||||
#include <QMap>
|
||||
#include <QMutex>
|
||||
#include <QReadWriteLock>
|
||||
#include <QMetaType>
|
||||
#include "pb/serverinfo_user.pb.h"
|
||||
#include "pb/serverinfo_room.pb.h"
|
||||
#include "pb/serverinfo_game.pb.h"
|
||||
|
||||
class Server_Game;
|
||||
class Server_Room;
|
||||
|
|
@ -29,7 +32,7 @@ signals:
|
|||
private slots:
|
||||
void broadcastRoomUpdate(const ServerInfo_Room &roomInfo, bool sendToIsl = false);
|
||||
public:
|
||||
mutable QMutex serverMutex;
|
||||
mutable QReadWriteLock clientsLock, roomsLock;
|
||||
Server(QObject *parent = 0);
|
||||
~Server();
|
||||
AuthenticationResult loginUser(Server_ProtocolHandler *session, QString &name, const QString &password, QString &reason);
|
||||
|
|
@ -67,9 +70,12 @@ public:
|
|||
void removeExternalUser(const QString &userName);
|
||||
const QMap<QString, Server_AbstractUserInterface *> &getExternalUsers() const { return externalUsers; }
|
||||
protected slots:
|
||||
void externalUserJoined(ServerInfo_User userInfo);
|
||||
void externalUserLeft(QString userName);
|
||||
void externalRoomUpdated(ServerInfo_Room roomInfo);
|
||||
void externalUserJoined(const ServerInfo_User &userInfo);
|
||||
void externalUserLeft(const QString &userName);
|
||||
void externalRoomUserJoined(int roomId, const ServerInfo_User &userInfo);
|
||||
void externalRoomUserLeft(int roomId, const QString &userName);
|
||||
void externalRoomSay(int roomId, const QString &userName, const QString &message);
|
||||
void externalRoomGameListChanged(int roomId, const ServerInfo_Game &gameInfo);
|
||||
protected:
|
||||
void prepareDestroy();
|
||||
QList<Server_ProtocolHandler *> clients;
|
||||
|
|
@ -95,4 +101,8 @@ protected:
|
|||
virtual void doSendIslMessage(const IslMessage &msg, int serverId) { }
|
||||
};
|
||||
|
||||
Q_DECLARE_METATYPE(ServerInfo_User)
|
||||
Q_DECLARE_METATYPE(ServerInfo_Room)
|
||||
Q_DECLARE_METATYPE(ServerInfo_Game)
|
||||
|
||||
#endif
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue