Skip to content

Commit

Permalink
feat(coap): delay startup until network is ready
Browse files Browse the repository at this point in the history
This unbreaks the coap-client example in DHCP configurations.
  • Loading branch information
chrysn committed Jan 30, 2025
1 parent fc9149f commit f31c0e9
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions src/ariel-os-coap/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,13 @@ async fn coap_run_impl(handler: impl coap_handler::Handler + coap_handler::Repor

let stack = ariel_os_embassy::net::network_stack().await.unwrap();

// There's no strong need to wait this early (it matters that we wait before populating
// CLIENT), but this is a convenient place in the code (we have a `stack` now, to populate
// CLIENT after the server, we'd have to poll the server and `wait_config_up` in parallel), and
// it's not like we'd expect requests to come in before everything is up. (Not even a loopback
// request, because we shouldn't hand out a client early).
stack.wait_config_up().await;

// FIXME trim to CoAP requirements
let mut rx_meta = [PacketMetadata::EMPTY; 16];
let mut rx_buffer = [0; 4096];
Expand Down

0 comments on commit f31c0e9

Please sign in to comment.