Skip to content

Commit

Permalink
Retry to connect to network in esp-tester.
Browse files Browse the repository at this point in the history
  • Loading branch information
floitsch committed Jan 14, 2025
1 parent 0754079 commit fbc84cb
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion tests/hw/esp-tester/mini-jag.toit
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,8 @@ import uuid show Uuid

import .shared

NETWORK-RETRIES ::= 4

main:
cause := esp32.wakeup-cause
print "Wakeup cause: $cause"
Expand All @@ -27,7 +29,12 @@ install-new-test:
if id != containers.current:
containers.uninstall id

network := net.open
network/net.Client? := null
for i := 0; i < NETWORK_RETRIES; i++:
catch --unwind=(: i == NETWORK_RETRIES - 1):
network = net.open
break
sleep (Duration --s=i)
server-socket := network.tcp-listen 0
print "$network.address:$server-socket.local-address.port"
print MINI-JAG-LISTENING
Expand Down

0 comments on commit fbc84cb

Please sign in to comment.