* VRFS-798 - close connection if a heartbeat can not be correlated to a connection, or memory state

This commit is contained in:
Seth Call 2013-10-23 15:46:30 +00:00
parent aff6df7028
commit 550a1ae6df
2 changed files with 2 additions and 1 deletions

View File

@ -92,7 +92,6 @@
function loggedIn(header, payload) {
app.clientId = payload.client_id;
$.cookie('client_id', payload.client_id);
// $.cookie('remember_token', payload.token); // removed per vrfs-273/403
heartbeatMS = payload.heartbeat_interval * 1000;
logger.debug("jamkazam.js.loggedIn(): clientId now " + app.clientId + "; Setting up heartbeat every " + heartbeatMS + " MS");

View File

@ -538,11 +538,13 @@ module JamWebsockets
unless context = @clients[client]
@log.warn "*** WARNING: unable to find context due to heartbeat from client: #{client.client_id}; calling cleanup"
cleanup_client(client)
raise SessionError, 'context state is gone. please reconnect.'
else
connection = Connection.find_by_user_id_and_client_id(context.user.id, context.client.client_id)
if connection.nil?
@log.warn "*** WARNING: unable to find connection due to heartbeat from client: #{context}; calling cleanup_client"
cleanup_client(client)
raise SessionError, 'connection state is gone. please reconnect.'
else
connection.touch