Skip to content

Commit 9ec622d

Browse files
caaaat-zzxAlianBlank
authored andcommitted
异地登录时,移除旧的Session
1 parent d5f3ebd commit 9ec622d

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

GameFrameX.Apps/Common/Session/SessionManager.cs

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -156,7 +156,7 @@ public static void Add(Session session)
156156
SessionMap[session.Id] = session;
157157
}
158158

159-
/// <summary>
159+
/// <summary>
160160
/// 更新会话,处理角色ID和签名的更新。
161161
/// 如果角色ID已在其他设备上登录,则会通知旧会话并关闭其连接。
162162
/// </summary>
@@ -180,6 +180,9 @@ public static async void UpdateSession(string sessionId, long roleId, string sig
180180
// 清除旧会话的连接数据并关闭连接
181181
oldSession.WorkChannel.ClearData();
182182
oldSession.WorkChannel.Close();
183+
184+
// 这里先移除,等待Disconnected回调断开太慢了
185+
Remove(oldSession.Id);
183186
}
184187

185188
// 获取当前会话并更新角色ID和签名

0 commit comments

Comments
 (0)