|
|
|
@ -12,12 +12,13 @@ public class SessionMgr
|
|
|
|
|
private static readonly ConcurrentDictionary<string, IoSession> Dictionary =
|
|
|
|
|
new ConcurrentDictionary<string, IoSession>();
|
|
|
|
|
|
|
|
|
|
public static void RegisterSession(string key, IoSession ioSession)
|
|
|
|
|
public static void RegisterSession(IChannel channel, IoSession ioSession)
|
|
|
|
|
{
|
|
|
|
|
ioSession.Key = key;
|
|
|
|
|
ioSession.Key = channel.Id.ToString();
|
|
|
|
|
IoSession? session;
|
|
|
|
|
Dictionary.Remove(ioSession.Key, out session);
|
|
|
|
|
Dictionary.AddOrUpdate(key, ioSession, (k, oldSession) => ioSession);
|
|
|
|
|
ChannelUtils.AddChannelSession(channel, ioSession);
|
|
|
|
|
Dictionary.AddOrUpdate(channel.Id.ToString(), ioSession, (k, oldSession) => ioSession);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public static void UnregisterSession(IChannel channel)
|
|
|
|
|