public static void InsertUser(AsyncClient ci) { lock (ChainLock) { ci.GUID = Guid.NewGuid().ToString(); ConCurrentList.Add(ci.GUID, ci); //Log.WriteLine(string.Format("A new user has been connected. IP = {0} ", ci.IP)); Interlocked.Increment(ref ClientCount); } }
public static void RemoveUser(AsyncClient ci) { lock (ChainLock) { try { ConCurrentList.Remove(ci.GUID); //Log.WriteLine(string.Format("[{0}] has left game.", ci.State.CharacterID)); //Log.WriteLine(string.Format("A client has been disconnected. IP = {0}", ci.IP)); ci.Dispose(); socketEnforcer.Release(1); sockidlist[(short)(1500 - ci.Index)] = false; Interlocked.Decrement(ref ClientCount); } catch { } } }