Skip to content
Snippets Groups Projects
Commit 7f3b3e02 authored by Daniel Gerhardt's avatar Daniel Gerhardt
Browse files

Fix session leaving

A NotFoundException was mistakenly thrown when the Session was set to
null via Socket.IO. Additionally, the user count was sent before it
had been updated.
parent 404954bd
Branches
Tags
No related merge requests found
......@@ -111,7 +111,7 @@ public class SessionService implements ISessionService {
public final Session joinSession(final String keyword, final UUID socketId) {
/* Socket.IO solution */
Session session = databaseDao.getSessionFromKeyword(keyword);
Session session = null != keyword ? databaseDao.getSessionFromKeyword(keyword) : null;
if (null == session) {
userService.removeUserFromSessionBySocketId(socketId);
......
......@@ -157,9 +157,6 @@ public class ARSnovaSocketIOServer implements ApplicationListener<NovaEvent>, No
if (session.getKeyword() == oldSessionKey) {
return;
}
if (null != oldSessionKey) {
reportActiveUserCountForSession(oldSessionKey);
}
if (null != sessionService.joinSession(session.getKeyword(), client.getSessionId())) {
/* active user count has to be sent to the client since the broadcast is
......@@ -167,6 +164,9 @@ public class ARSnovaSocketIOServer implements ApplicationListener<NovaEvent>, No
reportActiveUserCountForSession(session.getKeyword());
reportSessionDataToClient(session.getKeyword(), u, client);
}
if (null != oldSessionKey) {
reportActiveUserCountForSession(oldSessionKey);
}
}
});
......
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment