protected virtual ClientSession IntializeNewSession(INetworkClient client) { ClientSession session = new ClientSession(client); client.SetClientSession(session); return(session); }
public void AddSession(INetworkClient customClient) { Logger.Info(Language.Instance.GetMessageFromKey("NEW_CONNECT") + customClient.ClientId); ClientSession session = IntializeNewSession(customClient); customClient.SetClientSession(session); if (session != null && IsWorldServer && !_sessions.TryAdd(customClient.ClientId, session)) { Logger.Warn(string.Format(Language.Instance.GetMessageFromKey("FORCED_DISCONNECT"), customClient.ClientId)); customClient.Disconnect(); _sessions.TryRemove(customClient.ClientId, out session); } }
public void AddSession(INetworkClient customClient) { Logger.Log.Info(Language.Instance.GetMessageFromKey("NEW_CONNECT") + customClient.ClientId); ClientSession session = IntializeNewSession(customClient); customClient.SetClientSession(session); if (session != null && IsWorldServer) { if (!_sessions.TryAdd(customClient.ClientId, session)) { Logger.Log.WarnFormat(Language.Instance.GetMessageFromKey("FORCED_DISCONNECT"), customClient.ClientId); customClient.Disconnect(); _sessions.TryRemove(customClient.ClientId, out session); return; } } }
public void AddSession(INetworkClient customClient) { Logger.Log.Info(Language.Instance.GetMessageFromKey("NEW_CONNECT") + customClient.ClientId); ClientSession session = IntializeNewSession(customClient); customClient.SetClientSession(session); if (session == null || !IsWorldServer) { return; } if (Sessions.TryAdd(customClient.ClientId, session)) { return; } Logger.Log.WarnFormat(Language.Instance.GetMessageFromKey("FORCED_DISCONNECT"), customClient.ClientId); customClient.Disconnect(); Sessions.TryRemove(customClient.ClientId, out session); }
protected virtual ClientSession IntializeNewSession(INetworkClient client) { ClientSession session = new ClientSession(client); client.SetClientSession(session); return session; }