From 72d20de8e77853417efb272da3ff88dd281b009e Mon Sep 17 00:00:00 2001 From: jp9000 Date: Wed, 2 Aug 2017 13:36:33 -0700 Subject: [PATCH] Revert "UI: Add support for Twitch "Auto" server in auto-config" This reverts commit 2604db6e404cc1719ae779961ca12ed27fd06e89. The API to get the closest server can be down occasionally, so instead just revert to its previous behavior. --- UI/window-basic-auto-config-test.cpp | 6 ++---- UI/window-basic-auto-config.cpp | 17 +++++++++++++++-- 2 files changed, 17 insertions(+), 6 deletions(-) diff --git a/UI/window-basic-auto-config-test.cpp b/UI/window-basic-auto-config-test.cpp index 527b4861a..1bac94c59 100644 --- a/UI/window-basic-auto-config-test.cpp +++ b/UI/window-basic-auto-config-test.cpp @@ -246,10 +246,8 @@ void AutoConfigTestPage::TestBandwidthThread() GetServers(servers); /* just use the first server if it only has one alternate server, - * or if using Twitch/Mixer due to the "auto" option */ - if (servers.size() < 3 || - wiz->service == AutoConfig::Service::Twitch || - wiz->serviceName == "Mixer.com - FTL") + * or if using Mixer due to its "auto" server */ + if (servers.size() < 3 || wiz->serviceName == "Mixer.com - FTL") servers.resize(1); /* -----------------------------------*/ diff --git a/UI/window-basic-auto-config.cpp b/UI/window-basic-auto-config.cpp index 15933f2ab..f3d1c4139 100644 --- a/UI/window-basic-auto-config.cpp +++ b/UI/window-basic-auto-config.cpp @@ -365,7 +365,8 @@ void AutoConfigStreamPage::ServiceChanged() return; std::string service = QT_TO_UTF8(ui->service->currentText()); - bool regionBased = service == "hitbox.tv"; + bool regionBased = service == "Twitch" || + service == "hitbox.tv"; bool testBandwidth = ui->doBandwidthTest->isChecked(); bool custom = ui->streamType->currentIndex() == 1; @@ -658,7 +659,19 @@ bool AutoConfig::CanTestServer(const char *server) if (!testRegions || (regionUS && regionEU && regionAsia && regionOther)) return true; - if (service == Service::Hitbox) { + if (service == Service::Twitch) { + if (astrcmp_n(server, "US West:", 8) == 0 || + astrcmp_n(server, "US East:", 8) == 0 || + astrcmp_n(server, "US Central:", 11) == 0) { + return regionUS; + } else if (astrcmp_n(server, "EU:", 3) == 0) { + return regionEU; + } else if (astrcmp_n(server, "Asia:", 5) == 0) { + return regionAsia; + } else if (regionOther) { + return true; + } + } else if (service == Service::Hitbox) { if (strcmp(server, "Default") == 0) { return true; } else if (astrcmp_n(server, "US-West:", 8) == 0 ||