From ef7523e5b7a36f0f15b77d4e673afdda0df51f3a Mon Sep 17 00:00:00 2001 From: Dario Nieuwenhuis Date: Thu, 17 Aug 2023 00:53:25 +0200 Subject: [PATCH] net-esp-hosted: put link down on wifi disconnect. --- embassy-net-esp-hosted/src/lib.rs | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/embassy-net-esp-hosted/src/lib.rs b/embassy-net-esp-hosted/src/lib.rs index b1fa775c..c2d9d609 100644 --- a/embassy-net-esp-hosted/src/lib.rs +++ b/embassy-net-esp-hosted/src/lib.rs @@ -128,6 +128,7 @@ where let mut runner = Runner { ch: ch_runner, + state_ch, shared: &state.shared, next_seq: 1, handshake, @@ -142,6 +143,7 @@ where pub struct Runner<'a, SPI, IN, OUT> { ch: ch::Runner<'a, MTU>, + state_ch: ch::StateRunner<'a>, shared: &'a Shared, next_seq: u16, @@ -322,6 +324,10 @@ where match payload { CtrlMsgPayload::EventEspInit(_) => self.shared.init_done(), + CtrlMsgPayload::EventStationDisconnectFromAp(e) => { + info!("disconnected, code {}", e.resp); + self.state_ch.set_link_state(LinkState::Down); + } _ => {} } }