removed recursive lock in server; moved object serialisation to worker thread

This commit is contained in:
Max-Wilhelm Bruker
2012-10-14 13:19:03 +02:00
parent e7fc3b59a7
commit 43d7cf6a1a
6 changed files with 52 additions and 38 deletions

View File

@@ -38,6 +38,8 @@ Server_ProtocolHandler::~Server_ProtocolHandler()
{
}
// This function must only be called from the thread this object lives in.
// The thread must not hold any server locks when calling this (e.g. clientsLock, roomsLock).
void Server_ProtocolHandler::prepareDestroy()
{
if (deleted)
@@ -399,6 +401,8 @@ Response::ResponseCode Server_ProtocolHandler::cmdGetGamesOfUser(const Command_G
if (authState == NotLoggedIn)
return Response::RespLoginNeeded;
// XXX This does not take external users into account.
// XXX Maybe remove this check and test if the result list is empty at the end.
server->clientsLock.lockForRead();
if (!server->getUsers().contains(QString::fromStdString(cmd.user_name())))
return Response::RespNameNotFound;