Verbose retry counter
This commit is contained in:
parent
c57382dfa4
commit
99e0f9ae91
1 changed files with 11 additions and 2 deletions
|
@ -83,9 +83,16 @@ class ServerPage extends StatelessWidget {
|
||||||
ScaffoldMessenger.of(context).showSnackBar(SnackBar(
|
ScaffoldMessenger.of(context).showSnackBar(SnackBar(
|
||||||
content:
|
content:
|
||||||
Text("Login Success - Downloading remote Settings")));
|
Text("Login Success - Downloading remote Settings")));
|
||||||
|
|
||||||
|
int retryCount = 0;
|
||||||
while (true) {
|
while (true) {
|
||||||
try {
|
try {
|
||||||
await Future.delayed(Duration(seconds: 5));
|
if (retryCount > 0)
|
||||||
|
ScaffoldMessenger.of(context).showSnackBar(SnackBar(
|
||||||
|
content: Text(
|
||||||
|
"> Retrying to download settings in 10 seconds (Attempt $retryCount")));
|
||||||
|
|
||||||
|
await Future.delayed(Duration(seconds: 10));
|
||||||
S2CResponse settingsData = await settings.client!
|
S2CResponse settingsData = await settings.client!
|
||||||
.send(C2SRequestSettingsPacket(), true);
|
.send(C2SRequestSettingsPacket(), true);
|
||||||
C2SRequestSettingsPacket settingsBack =
|
C2SRequestSettingsPacket settingsBack =
|
||||||
|
@ -93,7 +100,9 @@ class ServerPage extends StatelessWidget {
|
||||||
settingsBack.decodeTag(settingsData.contents);
|
settingsBack.decodeTag(settingsData.contents);
|
||||||
settingsBack.handleClientPacket();
|
settingsBack.handleClientPacket();
|
||||||
break;
|
break;
|
||||||
} catch (E) {}
|
} catch (E) {
|
||||||
|
retryCount++;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
Navigator.pushNamed(context, "/home");
|
Navigator.pushNamed(context, "/home");
|
||||||
|
|
Loading…
Reference in a new issue