aboutsummaryrefslogtreecommitdiff
path: root/examples/stm32f4/src/bin/eth.rs
diff options
context:
space:
mode:
Diffstat (limited to 'examples/stm32f4/src/bin/eth.rs')
-rw-r--r--examples/stm32f4/src/bin/eth.rs8
1 files changed, 6 insertions, 2 deletions
diff --git a/examples/stm32f4/src/bin/eth.rs b/examples/stm32f4/src/bin/eth.rs
index 393e60b73..16bf5d949 100644
--- a/examples/stm32f4/src/bin/eth.rs
+++ b/examples/stm32f4/src/bin/eth.rs
@@ -79,7 +79,10 @@ async fn main(spawner: Spawner) -> ! {
79 )); 79 ));
80 80
81 // Launch network task 81 // Launch network task
82 unwrap!(spawner.spawn(net_task(&stack))); 82 unwrap!(spawner.spawn(net_task(stack)));
83
84 // Ensure DHCP configuration is up before trying connect
85 stack.wait_config_up().await;
83 86
84 info!("Network task initialized"); 87 info!("Network task initialized");
85 88
@@ -97,6 +100,7 @@ async fn main(spawner: Spawner) -> ! {
97 let r = socket.connect(remote_endpoint).await; 100 let r = socket.connect(remote_endpoint).await;
98 if let Err(e) = r { 101 if let Err(e) = r {
99 info!("connect error: {:?}", e); 102 info!("connect error: {:?}", e);
103 Timer::after(Duration::from_secs(1)).await;
100 continue; 104 continue;
101 } 105 }
102 info!("connected!"); 106 info!("connected!");
@@ -105,7 +109,7 @@ async fn main(spawner: Spawner) -> ! {
105 let r = socket.write_all(&buf).await; 109 let r = socket.write_all(&buf).await;
106 if let Err(e) = r { 110 if let Err(e) = r {
107 info!("write error: {:?}", e); 111 info!("write error: {:?}", e);
108 continue; 112 break;
109 } 113 }
110 Timer::after(Duration::from_secs(1)).await; 114 Timer::after(Duration::from_secs(1)).await;
111 } 115 }