From 9a07d5a33a617819287afb5067060c6699b61b88 Mon Sep 17 00:00:00 2001 From: Cameron Gutman Date: Sat, 24 Sep 2016 21:26:50 -0700 Subject: [PATCH] Display an error if attempting to close another session's app rather than silently failing --- Limelight/ViewControllers/MainFrameViewController.m | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/Limelight/ViewControllers/MainFrameViewController.m b/Limelight/ViewControllers/MainFrameViewController.m index 8fedad6..ddf8bc5 100644 --- a/Limelight/ViewControllers/MainFrameViewController.m +++ b/Limelight/ViewControllers/MainFrameViewController.m @@ -417,6 +417,17 @@ static NSMutableSet* hostList; // Exempt this host from discovery while handling the quit operation [_discMan removeHostFromDiscovery:app.host]; [hMan executeRequestSynchronously:quitRequest]; + if (quitResponse.statusCode == 200) { + ServerInfoResponse* serverInfoResp = [[ServerInfoResponse alloc] init]; + [hMan executeRequestSynchronously:[HttpRequest requestForResponse:serverInfoResp withUrlRequest:[hMan newServerInfoRequest] + fallbackError:401 fallbackRequest:[hMan newHttpServerInfoRequest]]]; + if (![serverInfoResp isStatusOk] || ![[serverInfoResp getStringTag:@"state"] hasSuffix:@"_SERVER_AVAILABLE"]) { + // On newer GFE versions, the quit request succeeds even though the app doesn't + // really quit if another client tries to kill your app. We'll patch the response + // to look like the old error in that case, so the UI behaves. + quitResponse.statusCode = 599; + } + } [_discMan addHostToDiscovery:app.host]; UIAlertController* alert;