mirror of
https://github.com/redstrate/Astra.git
synced 2025-04-23 04:57:44 +00:00
If the network is unavailable, keep trying to check for maintenance
This commit is contained in:
parent
d891a87d41
commit
fbc2a29b67
1 changed files with 8 additions and 0 deletions
|
@ -174,6 +174,14 @@ void SquareLauncher::gateOpen() {
|
||||||
|
|
||||||
auto reply = window.mgr->get(request);
|
auto reply = window.mgr->get(request);
|
||||||
connect(reply, &QNetworkReply::finished, [this, reply] {
|
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());
|
QJsonDocument document = QJsonDocument::fromJson(reply->readAll());
|
||||||
|
|
||||||
isGateOpen = !document.isEmpty() && document.object()["status"].toInt() != 0;
|
isGateOpen = !document.isEmpty() && document.object()["status"].toInt() != 0;
|
||||||
|
|
Loading…
Add table
Reference in a new issue