处理disconnect的在线状态

This commit is contained in:
heavyrian2012
2022-03-23 19:55:58 +08:00
parent 4bc5fd6bb9
commit a3f2623d7e
2 changed files with 8 additions and 2 deletions
@@ -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);
}
}