mirror of
https://github.com/Cockatrice/Cockatrice.git
synced 2026-04-27 07:48:01 -07:00
store sessions in database
This commit is contained in:
parent
a7f3ce4050
commit
1455c093cc
8 changed files with 52 additions and 2 deletions
|
|
@ -82,6 +82,9 @@ AuthenticationResult Server::loginUser(Server_ProtocolHandler *session, QString
|
|||
users.insert(name, session);
|
||||
qDebug() << "Server::loginUser: name=" << name;
|
||||
|
||||
session->setSessionId(startSession(name, session->getAddress()));
|
||||
qDebug() << "session id:" << session->getSessionId();
|
||||
|
||||
Event_UserJoined *event = new Event_UserJoined(new ServerInfo_User(data, false));
|
||||
for (int i = 0; i < clients.size(); ++i)
|
||||
if (clients[i]->getAcceptsUserListChanges())
|
||||
|
|
@ -111,6 +114,10 @@ void Server::removeClient(Server_ProtocolHandler *client)
|
|||
|
||||
users.remove(data->getName());
|
||||
qDebug() << "Server::removeClient: name=" << data->getName();
|
||||
|
||||
if (client->getSessionId() != -1)
|
||||
endSession(client->getSessionId());
|
||||
qDebug() << "closed session id:" << client->getSessionId();
|
||||
}
|
||||
qDebug() << "Server::removeClient:" << clients.size() << "clients; " << users.size() << "users left";
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue