Пример #1
0
        private static void CloseConnection(IPEndPoint endpoint)
        {
            string addressStr = endpoint.GetAddressString();

            if (connections.Remove(addressStr))
            {
                Logging.Log($"[CONNECITON] No longer accepting connections from {addressStr}");
            }
        }
Пример #2
0
 public static void CheckPassword(IPEndPoint endpoint, string data)
 {
     if (data == settings.ServerPassword)
     {
         SendMessage(endpoint, ENetID.ID_PasswordCorrect);
         connections.Add(endpoint.GetAddressString());
     }
     else
     {
         SendMessage(endpoint, ENetID.ID_ConnectionClosed);
     }
 }
Пример #3
0
        private static bool IsRegistered(IPEndPoint endpoint)
        {
            if (settings.AllowAll)
            {
                return(true);
            }

            bool whitelisted = connections.Exists(element => element == endpoint.GetAddressString());

            if (!whitelisted)
            {
                SendMessage(endpoint, ENetID.ID_ConnectionClosed);
            }

            return(whitelisted);
        }