Exemple #1
0
        private bool CheckTCPHostBan(TCPConnectionManager.PendingClient player, ref string reason)
        {
            if (IsAddressBanned == null)
            {
                return(false);
            }

            bool banned = IsAddressBanned(player.HostEntry.HostName, false, ref reason);

            if (banned)
            {
                PlayerAddressBanned?.Invoke(this, player);
            }

            return(banned);
        }
Exemple #2
0
        protected virtual void BZFSProtocolConnectionAccepted(object sender, TCPConnectionManager.PendingClient e)
        {
            var player = AcceptTCPConnection(e);

            if (player == null) // could not make a player for some reason
            {
                e.ClientConnection.Client.Disconnect(false);
                return;
            }

            UDPConnections.AddAcceptalbePlayer(e.GetIPAddress(), player);
            player.WriteUDP = UDPConnections.WriteUDP;

            // send them into the restricted zone until they validate
            SecurityArea.AddPendingConnection(player);

            Logger.Log1("PlayerID " + player.PlayerID.ToString() + " accepted from " + player.GetTCPRemoteAddresString());
        }
Exemple #3
0
        protected virtual ServerPlayer AcceptTCPConnection(TCPConnectionManager.PendingClient client)
        {
            ServerPlayer p = NewPlayerRecord(client);

            Logger.Log3("Socket " + p.GetTCPRemoteAddresString() + " Connected ");

            p.Disconnected += P_Disconnected;

            p.PlayerID = FindPlayerID();
            if (p.PlayerID < 0)
            {
                return(null);
            }

            lock (ConnectedPlayers)
                ConnectedPlayers.Add(p.PlayerID, p);

            NewConnection?.Invoke(this, p);

            return(p);
        }
Exemple #4
0
 protected virtual ServerPlayer NewPlayerRecord(TCPConnectionManager.PendingClient client)
 {
     return(new ServerPlayer(client.ClientConnection));
 }