diff --git a/RageCoop.Client/Networking/Networking.cs b/RageCoop.Client/Networking/Networking.cs index 7201ac4..1b02c23 100644 --- a/RageCoop.Client/Networking/Networking.cs +++ b/RageCoop.Client/Networking/Networking.cs @@ -21,6 +21,7 @@ namespace RageCoop.Client internal static readonly Dictionary> RequestHandlers = new Dictionary>(); internal static float SimulatedLatency=0; public static bool IsConnecting { get; private set; } + public static IPEndPoint _targetServerEP; static Networking() { Security=new Security(Main.Logger); @@ -77,7 +78,7 @@ namespace RageCoop.Client PlayerList.Cleanup(); EntityPool.AddPlayer(); - if (publicKey==null && !string.IsNullOrEmpty(password) && !Menus.CoopMenu.ShowPopUp("WARNING", "WARNING", "Server's IP can be spoofed when using direct connection, do you wish to continue?", "", true)) + if (publicKey==null && !string.IsNullOrEmpty(password) && !Menus.CoopMenu.ShowPopUp("", "WARNING", "Server's IP can be spoofed when using direct connection, do you wish to continue?", "", true)) { IsConnecting=false; return; @@ -86,6 +87,7 @@ namespace RageCoop.Client { try { + _targetServerEP=CoreUtils.StringToEndPoint(address); DownloadManager.Cleanup(); Peer = new CoopPeer(config); Peer.OnMessageReceived+= (s, m) => diff --git a/RageCoop.Client/Networking/Receive.cs b/RageCoop.Client/Networking/Receive.cs index 6c4efdf..4f00e14 100644 --- a/RageCoop.Client/Networking/Receive.cs +++ b/RageCoop.Client/Networking/Receive.cs @@ -197,7 +197,7 @@ namespace RageCoop.Client } case PacketType.PublicKeyResponse: { - if(Security.ServerRSA!=null){break;} + if(message.SenderEndPoint.ToString()!=_targetServerEP.ToString() ||!IsConnecting){break;} var packet = data.GetPacket(); Security.SetServerPublicKey(packet.Modulus, packet.Exponent); _publicKeyReceived.Set();