1
Fork 0
mirror of https://github.com/redstrate/Astra.git synced 2025-04-22 20:47:45 +00:00

If the network is unavailable, keep trying to check for maintenance

This commit is contained in:
redstrate 2022-01-11 00:16:22 -05:00
parent d891a87d41
commit fbc2a29b67

View file

@ -174,6 +174,14 @@ void SquareLauncher::gateOpen() {
auto reply = window.mgr->get(request);
connect(reply, &QNetworkReply::finished, [this, reply] {
// I happen to run into this issue often, if I start the launcher really quickly after bootup
// it's possible to actually check this quicker than the network is actually available,
// causing the launcher to be stuck in "maintenace mode". so if that happens, we try to rerun this logic.
// TODO: this selection of errors is currently guesswork, i'm assuming one of these will fit the bill of "internet is unavailable" in
// some way.
if(reply->error() == QNetworkReply::HostNotFoundError || reply->error() == QNetworkReply::TimeoutError || reply->error() == QNetworkReply::UnknownServerError)
gateOpen();
QJsonDocument document = QJsonDocument::fromJson(reply->readAll());
isGateOpen = !document.isEmpty() && document.object()["status"].toInt() != 0;