Пример #1
0
 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);
     }
 }
Пример #2
0
 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
         {
         }
     }
 }