处理disconnect的在线状态
This commit is contained in:
@@ -751,6 +751,7 @@ public class MemorySessionStore implements ISessionsStore {
|
||||
public void disableSession(String userId, String clientId) {
|
||||
Session session = sessions.get(clientId);
|
||||
if (session != null && session.getDeleted() == 0 && (userId == null || session.getUsername().equals(userId))) {
|
||||
mServer.getProcessor().processOffline(session, false);
|
||||
databaseStore.updateSessionDeleted(session.getUsername(), clientId, 1);
|
||||
ConcurrentSkipListSet<String> sessionSet = getUserSessionSet(session.username);
|
||||
sessionSet.remove(clientId);
|
||||
@@ -772,6 +773,7 @@ public class MemorySessionStore implements ISessionsStore {
|
||||
return;
|
||||
}
|
||||
|
||||
mServer.getProcessor().processOffline(session, true);
|
||||
ConcurrentSkipListSet<String> sessionSet = getUserSessionSet(session.username);
|
||||
sessionSet.remove(clientID);
|
||||
|
||||
|
||||
@@ -620,15 +620,19 @@ public class ProtocolProcessor {
|
||||
String username = NettyUtils.userName(channel);
|
||||
MemorySessionStore.Session session = m_sessionsStore.getSession(clientID);
|
||||
if(session != null) {
|
||||
session.refreshLastActiveTime();
|
||||
forwardOnlineStatusEvent(username, clientID, session.getPlatform(), clearSession ? UserOnlineStatus.LOGOUT : UserOnlineStatus.OFFLINE, session.getAppName());
|
||||
processOffline(session, clearSession);
|
||||
}
|
||||
|
||||
ConnectionDescriptor oldConnDescr = new ConnectionDescriptor(clientID, channel);
|
||||
if(connectionDescriptors.removeConnection(oldConnDescr)) {
|
||||
m_interceptor.notifyClientConnectionLost(clientID, username);
|
||||
}
|
||||
}
|
||||
|
||||
public void processOffline(MemorySessionStore.Session session, boolean clearSession) {
|
||||
if(session != null) {
|
||||
session.refreshLastActiveTime();
|
||||
forwardOnlineStatusEvent(session.getUsername(), session.getClientID(), session.getPlatform(), clearSession ? UserOnlineStatus.LOGOUT : UserOnlineStatus.OFFLINE, session.getAppName());
|
||||
m_messagesStore.updateUserOnlineSetting(session, false);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user