add wait_config_up to examples

This commit is contained in:
JuliDi 2023-09-08 17:40:20 +02:00
parent 3e0b752bef
commit cf2d4eca7c
No known key found for this signature in database
GPG key ID: 0C98FD5D6597BC5B
5 changed files with 18 additions and 6 deletions

View file

@ -79,7 +79,10 @@ async fn main(spawner: Spawner) -> ! {
));
// Launch network task
unwrap!(spawner.spawn(net_task(&stack)));
unwrap!(spawner.spawn(net_task(stack)));
// Ensure DHCP configuration is up before trying connect
stack.wait_config_up().await;
info!("Network task initialized");

View file

@ -80,7 +80,10 @@ async fn main(spawner: Spawner) -> ! {
));
// Launch network task
unwrap!(spawner.spawn(net_task(&stack)));
unwrap!(spawner.spawn(net_task(stack)));
// Ensure DHCP configuration is up before trying connect
stack.wait_config_up().await;
info!("Network task initialized");

View file

@ -101,6 +101,9 @@ async fn main(spawner: Spawner) -> ! {
// Launch network task
unwrap!(spawner.spawn(net_task(&stack)));
// Ensure DHCP configuration is up before trying connect
stack.wait_config_up().await;
info!("Network task initialized");
// Then we can use it!

View file

@ -83,6 +83,9 @@ async fn main(spawner: Spawner) -> ! {
// Launch network task
unwrap!(spawner.spawn(net_task(&stack)));
// Ensure DHCP configuration is up before trying connect
stack.wait_config_up().await;
info!("Network task initialized");
// Then we can use it!

View file

@ -82,13 +82,13 @@ async fn main(spawner: Spawner) -> ! {
));
// Launch network task
unwrap!(spawner.spawn(net_task(&stack)));
unwrap!(spawner.spawn(net_task(stack)));
// Ensure DHCP configuration is up before trying connect
stack.wait_config_up().await;
info!("Network task initialized");
// To ensure DHCP configuration before trying connect
Timer::after(Duration::from_secs(20)).await;
static STATE: TcpClientState<1, 1024, 1024> = TcpClientState::new();
let client = TcpClient::new(&stack, &STATE);