Verbose retry counter

This commit is contained in:
zontreck 2024-07-02 16:36:27 -07:00
parent c57382dfa4
commit 99e0f9ae91

View file

@ -83,9 +83,16 @@ class ServerPage extends StatelessWidget {
ScaffoldMessenger.of(context).showSnackBar(SnackBar(
content:
Text("Login Success - Downloading remote Settings")));
int retryCount = 0;
while (true) {
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!
.send(C2SRequestSettingsPacket(), true);
C2SRequestSettingsPacket settingsBack =
@ -93,7 +100,9 @@ class ServerPage extends StatelessWidget {
settingsBack.decodeTag(settingsData.contents);
settingsBack.handleClientPacket();
break;
} catch (E) {}
} catch (E) {
retryCount++;
}
}
Navigator.pushNamed(context, "/home");