Hi,
This is another take on exporting significant events from DHCP to plugins based
on feedback by Patrik Flykt. The original idea was to export only the next time
of interest that we must be awake for. This mechanism didn't allow connman to
request that we stay awake for short durations (such as during a renew) though,
so I've extended it to report both the next wake time as well as the minimum
time to stay awake. Additionally, because multiple components within connman
might have a conflicting state, we must tag requests by component and respect
any requests to stay awake.
The basic idea is creating a notifier that can be called from different
components with unique identifiers (here we use a dhcp_clent*, but anything
unique to a component should do) to request sleep state.
void __connman_notifier_sleep_event(void *identifier, bool canSleep,
time_t valid_until)
Any interested plugin will be responsible for aggregating valid votes from
all unique identifiers and may sleep only when at least one identifier which has
set canSleep, for no more than the shortest duration of validity. If any
identifier votes with canSleep clear, the system will not sleep for at least
that duration. During this sleep, any packets intended for the system must be
allowed to wake the system up.
Any comments on general mechanism or specific implementation would be welcome.
Thanks
-Andrew
Andrew LeCain (3):
dhcp: Fixing renew request logic according to paragraph 8 of section
4.4.5 in FC2131
notifier: adding new notifier for sleep and wake requests
dhcp: adding wake/sleep requests to dhcp
gdhcp/client.c | 166 ++++++++++++++++++++++++++++++++++++++++------------
gdhcp/gdhcp.h | 3 +
include/notifier.h | 2 +
src/connman.h | 2 +
src/dhcp.c | 20 +++++++
src/notifier.c | 12 ++++
6 files changed, 166 insertions(+), 39 deletions(-)
--
1.7.9.5
_______________________________________________
connman mailing list
[email protected]
https://lists.connman.net/mailman/listinfo/connman