diff --git a/src/main/java/de/thm/arsnova/services/SessionService.java b/src/main/java/de/thm/arsnova/services/SessionService.java index 07747a1c248d63fe2e220dc907df848c2091a4b7..91e39e990f055b77677f594adf0ac0856962764f 100644 --- a/src/main/java/de/thm/arsnova/services/SessionService.java +++ b/src/main/java/de/thm/arsnova/services/SessionService.java @@ -65,7 +65,12 @@ public class SessionService implements ISessionService { public final Session joinSession(final String keyword, final UUID socketId) { /* Socket.IO solution */ - Session session = databaseDao.getSession(keyword); + Session session = null; + try { + session = databaseDao.getSession(keyword); + } catch (NotFoundException e) { + + } if (null == session) { userService.removeUserFromSessionBySocketId(socketId); diff --git a/src/main/java/de/thm/arsnova/socket/ARSnovaSocketIOServer.java b/src/main/java/de/thm/arsnova/socket/ARSnovaSocketIOServer.java index 85ebf9d79689382224f95b28c9dd838ff6d6591f..66d4a2aa077d73da04e1631bba1d59fb5fb5c70c 100644 --- a/src/main/java/de/thm/arsnova/socket/ARSnovaSocketIOServer.java +++ b/src/main/java/de/thm/arsnova/socket/ARSnovaSocketIOServer.java @@ -112,11 +112,12 @@ public class ARSnovaSocketIOServer { server.addEventListener("setSession", Session.class, new DataListener<Session>() { @Override public void onData(SocketIOClient client, Session session, AckRequest ackSender) { - sessionService.joinSession(session.getKeyword(), client.getSessionId()); - /* active user count has to be sent to the client since the broadcast is - * not always sent as long as the polling solution is active simultaneously */ - reportActiveUserCountForSession(session.getKeyword()); - reportSessionDataToClient(session.getKeyword(), client); + if (null != sessionService.joinSession(session.getKeyword(), client.getSessionId())) { + /* active user count has to be sent to the client since the broadcast is + * not always sent as long as the polling solution is active simultaneously */ + reportActiveUserCountForSession(session.getKeyword()); + reportSessionDataToClient(session.getKeyword(), client); + } } });