Fix bug where Webservices Mod would fail if applied after resetting

This commit is contained in:
Yoshi Askharoun
2024-05-18 00:59:50 -05:00
parent fa43aa2584
commit 564a00ab1e
+5 -2
View File
@@ -21,7 +21,7 @@ namespace ZuneModCore.Mods
private const string WEBSERVICE_SUBTITLE_SUCCESS = "OK"; private const string WEBSERVICE_SUBTITLE_SUCCESS = "OK";
private const string WEBSERVICE_SUBTITLE_UNREACHABLE = "Unreachable"; private const string WEBSERVICE_SUBTITLE_UNREACHABLE = "Unreachable";
private readonly HttpClient _client = new(); private HttpClient _client;
private CancellationTokenSource _cts = new(); private CancellationTokenSource _cts = new();
public override string Id => nameof(WebservicesMod); public override string Id => nameof(WebservicesMod);
@@ -79,7 +79,10 @@ namespace ZuneModCore.Mods
public override Task Init() public override Task Init()
{ {
_client.Timeout = TimeSpan.FromSeconds(3); _client = new()
{
Timeout = TimeSpan.FromSeconds(3)
};
AbstractTextBox newHostBox = (AbstractTextBox)OptionsUI![0]; AbstractTextBox newHostBox = (AbstractTextBox)OptionsUI![0];
newHostBox.ValueChanged += OnHostChanged; newHostBox.ValueChanged += OnHostChanged;