public void Block(Int32 c, Warning player) { Pair <Int32, Warning> obj = IndexOfObject(c); lock (_lock) { if (obj == null) { Addresses.Add(new Pair <Int32, Warning>(c, player));// != null ? player : null)); // fix bug, object locked & null player } Warning.AddWarningToClient(player); } }
private void ClientsWatcher() // Heartbeats { bool check = false; short c = 0; do { Thread.Sleep(watch_delay); if (Globals.Clients.Count > 0) { if (c > 99) { foreach (Clientplayer temp in Globals.Clients.GetList()) { Clientplayer.CodeEvent(temp); } c = 0; } else { foreach (Clientplayer temp in Globals.Clients.GetList()) { if (check) { if (Clientplayer.IsAlive(temp)) { //lock(temp) if (!Clientplayer.Key(temp).Equals(Cryption.Decrypt( getkey(Clientplayer.GetRemoteEndPointIntPort(temp)), Clientplayer.GetRemoteEndPointString(temp), Clientplayer.GetCode16(temp), "SHA1", 10, Clientplayer.GetCodeByte(temp), 192))) { Warning.AddWarningToClient(Clientplayer.GetWarning(temp), true); } } } else { Clientplayer.Send(temp, UpdateKey(Clientplayer.GetRemoteEndPointIntPort(temp)), (byte)Enums.PacketID.key); } } check = !check; c++; } } } while (true); }