From d0c4b83de25e6d977c2e4b428a2a71f1a2ecd5cf Mon Sep 17 00:00:00 2001 From: Joonas Rikkonen Date: Thu, 23 May 2019 15:17:18 +0300 Subject: [PATCH] (3cd408e4a) Cancel Steam auth ticket when cancelling server connection (by clicking "Cancel" in either the "Connecting to..." popup or the password prompt). Fixes steam auth failed errors when attempting to reconnect after cancelling. --- .../Source/Networking/GameClient.cs | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/Barotrauma/BarotraumaClient/Source/Networking/GameClient.cs b/Barotrauma/BarotraumaClient/Source/Networking/GameClient.cs index 205820841..a6f94755a 100644 --- a/Barotrauma/BarotraumaClient/Source/Networking/GameClient.cs +++ b/Barotrauma/BarotraumaClient/Source/Networking/GameClient.cs @@ -319,10 +319,11 @@ namespace Barotrauma.Networking } private bool connectCancelled; - private bool CancelConnect(GUIButton button, object obj) + private void CancelConnect() { connectCancelled = true; - return true; + steamAuthTicket?.Cancel(); + steamAuthTicket = null; } // Before main looping starts, we loop here and wait for approval message @@ -347,7 +348,7 @@ namespace Barotrauma.Networking if (reconnectBox == null) { reconnectBox = new GUIMessageBox(connectingText, TextManager.Get("ConnectingTo").Replace("[serverip]", serverIP), new string[] { TextManager.Get("Cancel") }); - reconnectBox.Buttons[0].OnClicked += CancelConnect; + reconnectBox.Buttons[0].OnClicked += (btn, userdata) => { CancelConnect(); return true; }; reconnectBox.Buttons[0].OnClicked += reconnectBox.Close; } @@ -447,7 +448,7 @@ namespace Barotrauma.Networking if (connectionStatus == NetConnectionStatus.Disconnected) { ReadDisconnectMessage(inc, false); - connectCancelled = true; + CancelConnect(); } break; } @@ -489,7 +490,7 @@ namespace Barotrauma.Networking { ReadDisconnectMessage(inc, false); msgBox.Close(null, null); - connectCancelled = true; + CancelConnect(); } break; } @@ -521,7 +522,7 @@ namespace Barotrauma.Networking else if (cancelButton.Selected) { msgBox.Close(null, null); - connectCancelled = true; + CancelConnect(); } else { @@ -1803,7 +1804,6 @@ namespace Barotrauma.Networking { client.Shutdown(""); steamAuthTicket?.Cancel(); - steamAuthTicket = null; foreach (var fileTransfer in FileReceiver.ActiveTransfers)