Skip to content

Commit

Permalink
blah
Browse files Browse the repository at this point in the history
  • Loading branch information
Sardelka9515 committed Aug 18, 2022
1 parent 7566423 commit c4312fa
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
4 changes: 3 additions & 1 deletion RageCoop.Client/Networking/Networking.cs
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ internal static partial class Networking
internal static readonly Dictionary<PacketType, Func<byte[], Packet>> RequestHandlers = new Dictionary<PacketType, Func<byte[], Packet>>();
internal static float SimulatedLatency=0;
public static bool IsConnecting { get; private set; }
public static IPEndPoint _targetServerEP;
static Networking()
{
Security=new Security(Main.Logger);
Expand Down Expand Up @@ -77,7 +78,7 @@ public static void ToggleConnection(string address, string username = null, stri

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;
Expand All @@ -86,6 +87,7 @@ public static void ToggleConnection(string address, string username = null, stri
{
try
{
_targetServerEP=CoreUtils.StringToEndPoint(address);
DownloadManager.Cleanup();
Peer = new CoopPeer(config);
Peer.OnMessageReceived+= (s, m) =>
Expand Down
2 changes: 1 addition & 1 deletion RageCoop.Client/Networking/Receive.cs
Original file line number Diff line number Diff line change
Expand Up @@ -197,7 +197,7 @@ public static void ProcessMessage(NetIncomingMessage message)
}
case PacketType.PublicKeyResponse:
{
if(Security.ServerRSA!=null){break;}
if(message.SenderEndPoint.ToString()!=_targetServerEP.ToString() ||!IsConnecting){break;}
var packet = data.GetPacket<Packets.PublicKeyResponse>();
Security.SetServerPublicKey(packet.Modulus, packet.Exponent);
_publicKeyReceived.Set();
Expand Down

0 comments on commit c4312fa

Please sign in to comment.