From 96dc543b4e23be2969db1295518c24317af572d1 Mon Sep 17 00:00:00 2001 From: Patrik Flykt Date: Wed, 12 Oct 2011 13:56:38 +0300 Subject: [PATCH] notifier: Don't unnecessarily report "online" state on disconnect When a service disconnects, don't send an extra 'online' net.connman.Manager.StateChanged signal if another service is still connected. Fixes BMC#23421 --- src/notifier.c | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/src/notifier.c b/src/notifier.c index 722f997..332bafb 100644 --- a/src/notifier.c +++ b/src/notifier.c @@ -176,7 +176,7 @@ const char *__connman_notifier_get_state(void) return "offline"; } -static void state_changed(void) +static void state_changed(connman_bool_t connected) { unsigned int count = __connman_notifier_count_connected(); char *state = "offline"; @@ -185,8 +185,12 @@ static void state_changed(void) if (count > 1) return; - if (count > 0) + if (count == 1) { + if (connected == FALSE) + return; + state = "online"; + } connman_dbus_property_changed_basic(CONNMAN_MANAGER_PATH, CONNMAN_MANAGER_INTERFACE, "State", @@ -212,7 +216,7 @@ static void technology_connected(enum connman_service_type type, CONNMAN_MANAGER_INTERFACE, "ConnectedTechnologies", DBUS_TYPE_STRING, __connman_notifier_list_connected, NULL); - state_changed(); + state_changed(connected); } void __connman_notifier_register(enum connman_service_type type) -- 2.7.4