Commit deedc43a authored by Tom Evans's avatar Tom Evans

OF-866: Prevent "session not found" errors

Fixes a race condition by adding a newly authenticated session into the
core routing table before removing it from the list of
pre-authentication sessions.
parent c30b216a
......@@ -548,10 +548,10 @@ public class SessionManager extends BasicModule implements ClusterEventListener
* @param session the session that was authenticated.
*/
public void addSession(LocalClientSession session) {
// Remove the pre-Authenticated session but remember to use the temporary ID as the key
localSessionManager.getPreAuthenticatedSessions().remove(session.getStreamID().toString());
// Add session to the routing table (routing table will know session is not available yet)
routingTable.addClientRoute(session.getAddress(), session);
// Remove the pre-Authenticated session but remember to use the temporary ID as the key
localSessionManager.getPreAuthenticatedSessions().remove(session.getStreamID().toString());
SessionEventDispatcher.EventType event = session.getAuthToken().isAnonymous() ?
SessionEventDispatcher.EventType.anonymous_session_created :
SessionEventDispatcher.EventType.session_created;
......
Markdown is supported
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