Display an error if attempting to close another session's app rather than silently failing

This commit is contained in:
Cameron Gutman
2016-09-24 21:26:50 -07:00
parent 84c037f235
commit 9a07d5a33a

View File

@@ -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;