From 6a6c2aef0f5aaeae24ba377efc37dd7d8caea3ac Mon Sep 17 00:00:00 2001 From: bunnie Date: Wed, 30 Mar 2022 02:29:09 +0800 Subject: [PATCH] add a thread to respond to suspend requests on the connection manager the connection manager actually wants a ping on resume, and when we suspend we suspend -- "it is what it is". However, the connection manager is a hairball that can block for a while, so, to prevent failures to suspend, we put the suspend listener in its own thread, and on resume the suspend listener will automagically kick out an event to tell the connection manager to deal with stuff. --- services/net/src/connection_manager.rs | 34 ++++++++++++++++++++------ 1 file changed, 27 insertions(+), 7 deletions(-) diff --git a/services/net/src/connection_manager.rs b/services/net/src/connection_manager.rs index b82d7c23c..09d854f2f 100644 --- a/services/net/src/connection_manager.rs +++ b/services/net/src/connection_manager.rs @@ -131,9 +131,30 @@ pub(crate) fn connection_manager(sid: xous::SID, activity_interval: Arc xous::msg_scalar_unpack!(msg, token, _, _, _, { - // for now, nothing to do to prepare for suspend... - susres.suspend_until_resume(token).expect("couldn't execute suspend/resume"); - // on resume, check with the EC and see where the link state ended up + Some(ConnectionManagerOpcode::SuspendResume) => xous::msg_scalar_unpack!(msg, _, _, _, _, { + // this doesn't follow the usual "suspender" pattern. In fact, we don't do anything special on suspend; + // however, on resume, check with the EC and see where the link state ended up. let (res_linkstate, _res_dhcpstate) = com.wlan_sync_state().unwrap(); match res_linkstate { LinkState::Connected => {