From f53735f1d8ab584ea0f163d2ddcc41c04968bb61 Mon Sep 17 00:00:00 2001 From: "Unknown W. Brackets" Date: Mon, 4 Jul 2016 07:32:49 -0700 Subject: [PATCH] http: Add a safety bailout on list load. Hopefully this will prevent a crash. Currently http::Client uses blocking reads so it will just hang. --- UI/RemoteISOScreen.cpp | 19 +++++++++++++++++-- 1 file changed, 17 insertions(+), 2 deletions(-) diff --git a/UI/RemoteISOScreen.cpp b/UI/RemoteISOScreen.cpp index 7991256b52..f5e2a51933 100644 --- a/UI/RemoteISOScreen.cpp +++ b/UI/RemoteISOScreen.cpp @@ -47,6 +47,8 @@ static ServerStatus serverStatus; static recursive_mutex serverStatusLock; static condition_variable serverStatusCond; +static bool scanCancelled = false; + static void UpdateStatus(ServerStatus s) { lock_guard guard(serverStatusLock); serverStatus = s; @@ -194,7 +196,7 @@ static bool FindServer(std::string &resultHost, int &resultPort) { http.Disconnect(); } - if (code != 200) { + if (code != 200 || scanCancelled) { return false; } @@ -247,7 +249,7 @@ static bool LoadGameList(const std::string &host, int port, std::vector