Exemple #1
0
 public static void Disconnect(Clientplayer x, string msg)
 {
     if (IsAlive(x))
     {
         Log.Write("Client {0} disconnected, Reason: {1}", GetRemoteEndPointString(x), msg);
         x.networkStream.Close();
         x.ClientSocket.Close();
     }
     Globals.Clients.Remove(x);
     if (Warning.GetLevel(x.clientwarns) < 5 && Warning.GetKeyErrors(x.clientwarns) < 3)
     {
         Globals.Shield.UnBlock(GetRemoteEndPointInt(x));
     }
     //Warning.Terminate(x.clientwarns); // done by Garbage collector since no pointer on element if client is off
     x.streambytes.Clear();
 }
Exemple #2
0
 public static bool IsVaildProcess(Clientplayer x)
 {
     if (Warning.GetLevel(x.clientwarns) > 10)
     {
         if (DateTime.Compare(Warning.GetTime(x.clientwarns).AddSeconds(2), DateTime.Now) > 0)
         {
             Globals.Shield.Block(GetRemoteEndPointInt(x), x.clientwarns);
             Disconnect(x, "Illegal Packet delays");
             return(false);
         }
         else
         {
             Warning.Reset(x.clientwarns); // prevent overrun
         }
     }
     else if (Warning.GetKeyErrors(x.clientwarns) > 2)
     {
         Globals.Shield.Block(GetRemoteEndPointInt(x), x.clientwarns);
         Disconnect(x, "Client Key Error!");
         return(false);
     }
     return(IsAlive(x));
 }