mirror of
https://github.com/Cockatrice/Cockatrice.git
synced 2026-06-11 08:34:52 -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
|
|
@ -6,7 +6,7 @@
|
|||
#include <QObject>
|
||||
#include <QStringList>
|
||||
#include <QMutex>
|
||||
#include <QMetaType>
|
||||
#include <QReadWriteLock>
|
||||
#include "pb/serverinfo_room.pb.h"
|
||||
#include "serverinfo_user_container.h"
|
||||
|
||||
|
|
@ -35,9 +35,10 @@ private:
|
|||
QList<Server_ProtocolHandler *> userList;
|
||||
QMap<QString, ServerInfo_User_Container> externalUsers;
|
||||
private slots:
|
||||
void broadcastGameListUpdate(ServerInfo_Game gameInfo);
|
||||
void broadcastGameListUpdate(ServerInfo_Game gameInfo, bool sendToIsl = true);
|
||||
public:
|
||||
mutable QMutex roomMutex;
|
||||
mutable QReadWriteLock usersLock;
|
||||
mutable QMutex gamesMutex;
|
||||
Server_Room(int _id, const QString &_name, const QString &_description, bool _autoJoin, const QString &_joinMessage, const QStringList &_gameTypes, Server *parent);
|
||||
~Server_Room();
|
||||
int getId() const { return id; }
|
||||
|
|
@ -57,8 +58,10 @@ public:
|
|||
|
||||
void addExternalUser(const ServerInfo_User &userInfo);
|
||||
void removeExternalUser(const QString &name);
|
||||
const QMap<QString, ServerInfo_User_Container> &getExternalUsers() const { return externalUsers; }
|
||||
void updateExternalGameList(const ServerInfo_Game &gameInfo);
|
||||
|
||||
void say(Server_ProtocolHandler *client, const QString &s);
|
||||
void say(const QString &userName, const QString &s, bool sendToIsl = true);
|
||||
|
||||
void addGame(Server_Game *game);
|
||||
void removeGame(Server_Game *game);
|
||||
|
|
@ -67,7 +70,4 @@ public:
|
|||
RoomEvent *prepareRoomEvent(const ::google::protobuf::Message &roomEvent);
|
||||
};
|
||||
|
||||
Q_DECLARE_METATYPE(ServerInfo_Game)
|
||||
Q_DECLARE_METATYPE(ServerInfo_Room)
|
||||
|
||||
#endif
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue