diff --git a/Fika.Core/Networking/FikaClient.cs b/Fika.Core/Networking/FikaClient.cs index 0cc98155..79ee6280 100644 --- a/Fika.Core/Networking/FikaClient.cs +++ b/Fika.Core/Networking/FikaClient.cs @@ -137,6 +137,8 @@ protected async void Start() if (_netClient.ConnectedPeersCount == 0) { + _netClient.Stop(); + EFT.UI.ConsoleScreen.LogWarning("Connection to Stun endpoint failed, falling back to public ip"); GetHostRequest body = new(CoopHandler.GetServerId()); diff --git a/Fika.Core/Networking/FikaServer.cs b/Fika.Core/Networking/FikaServer.cs index ee1d2db2..57f4282c 100644 --- a/Fika.Core/Networking/FikaServer.cs +++ b/Fika.Core/Networking/FikaServer.cs @@ -96,7 +96,8 @@ public async void Start() IPv6Enabled = false, DisconnectTimeout = FikaPlugin.ConnectionTimeout.Value * 1000, UseNativeSockets = FikaPlugin.NativeSockets.Value, - EnableStatistics = true + EnableStatistics = true, + AllowPeerAddressChange = true }; var natPunchServer = new FikaNatPunchServer(_netServer); diff --git a/Fika.Core/Networking/NatPunch/FikaNatPunchServer.cs b/Fika.Core/Networking/NatPunch/FikaNatPunchServer.cs index 25d98219..46b7eb9f 100644 --- a/Fika.Core/Networking/NatPunch/FikaNatPunchServer.cs +++ b/Fika.Core/Networking/NatPunch/FikaNatPunchServer.cs @@ -60,7 +60,6 @@ public void Close() private void WebSocket_OnOpen(object sender, EventArgs e) { - //Logger.LogInfo($"Connected to NAT Helper"); EFT.UI.ConsoleScreen.Log("Connected to FikaNatPunchService as server"); } @@ -83,6 +82,7 @@ private void WebSocket_OnError(object sender, ErrorEventArgs e) private void ProcessMessage(string data) { + EFT.UI.ConsoleScreen.Log($"data: {data}"); var msgObj = GetRequestObject(data); var msgObjType = msgObj.GetType().Name; @@ -117,7 +117,7 @@ private void ProcessMessage(string data) private void Send(T1 o) { var data = JsonConvert.SerializeObject(o); - Send(data); + _webSocket.Send(data); } private object GetRequestObject(string data) diff --git a/Fika.Core/UI/Custom/MatchMakerUIScript.cs b/Fika.Core/UI/Custom/MatchMakerUIScript.cs index 67e837d9..7f4ffad4 100644 --- a/Fika.Core/UI/Custom/MatchMakerUIScript.cs +++ b/Fika.Core/UI/Custom/MatchMakerUIScript.cs @@ -208,6 +208,8 @@ private IEnumerator JoinMatch(string profileId, string serverId, Button button) yield return new WaitForSeconds(0.1f); } while (!success && attempts < 50); + success = true; + if (!success) { Singleton.Instance.ShowCriticalErrorScreen(