From 10a5876ce7a0945e5ed5ab7bc80ccb93e4a6a1d0 Mon Sep 17 00:00:00 2001 From: TomAwezome Date: Mon, 17 Jan 2022 00:12:18 -0500 Subject: [PATCH] Implement retries for when network stack fails NetConfigure. --- src/Home/Net/Start.ZC | 30 ++++++++++++++---------------- 1 file changed, 14 insertions(+), 16 deletions(-) diff --git a/src/Home/Net/Start.ZC b/src/Home/Net/Start.ZC index 3c3aafb8..53a58a4f 100755 --- a/src/Home/Net/Start.ZC +++ b/src/Home/Net/Start.ZC @@ -1,21 +1,19 @@ Cd(__DIR__);; #include "Load" -NetConfigure; - -if (Fs != sys_task) +I64 retries = 5; +while (ipv4_globals.local_ip == 0 && retries--) // local_ip is set if NetConfigure is successful { - if (ipv4_globals.local_ip != 0) // is set if NetConfigure is successful - { - NetRep; - - "\nNow run one of the $MA,"Tests",LM="Cd(\"C:/Home/Net/Tests\");Dir;\n"$ or $MA,"Programs",LM="Cd(\"C:/Home/Net/Programs\");Dir;\n"$.\n"; - - "\nIf a test crashes to Debug, try typing $FG,0$G2;$FG$\n\n"; - } - else - { - "\nNetConfigure unsuccessful. See Network Log for details.\n\n"; - } - + "\nNetConfigure unsuccessful. Retrying...\n"; + NetConfigure; +} +if (ipv4_globals.local_ip == 0) + "\nNetConfigure unsuccessful. See Network Log for details.\n\n"; +else + "\nNetConfigure successful!\n\n"; +NetRep; +if (ipv4_globals.local_ip != 0 && Fs != sys_task) +{ + "\nNow run one of the $MA,"Programs",LM="Cd(\"C:/Home/Net/Programs\");Dir;\n"$.\n"; + "\nIf anything crashes to Debug, try typing $FG,0$G2;$FG$\n\n"; }