diff --git a/Netch/Controllers/MainController.cs b/Netch/Controllers/MainController.cs index 1bf80a06..fa332191 100644 --- a/Netch/Controllers/MainController.cs +++ b/Netch/Controllers/MainController.cs @@ -34,7 +34,7 @@ namespace Netch.Controllers if (await DnsUtils.LookupAsync(server.Hostname) == null) throw new MessageException(i18N.Translate("Lookup Server hostname failed")); - + // TODO Disable NAT Type Test setting // cache STUN Server ip to prevent "Wrong STUN Server" DnsUtils.LookupAsync(Global.Settings.STUN_Server).Forget(); @@ -182,7 +182,20 @@ namespace Netch.Controllers public static async Task HttpConnectAsync(CancellationToken ctx = default) { Debug.Assert(Socks5Server != null, nameof(Socks5Server) + " != null"); - return await Socks5ServerTestUtils.HttpConnectAsync(Socks5Server, ctx); + try + { + return await Socks5ServerTestUtils.HttpConnectAsync(Socks5Server, ctx); + } + catch (OperationCanceledException) + { + // ignored + } + catch (Exception e) + { + Log.Warning(e, "Unhandled Socks5ServerTestUtils.HttpConnectAsync Exception"); + } + + return null; } } } \ No newline at end of file