summaryrefslogtreecommitdiff
path: root/src/notifier.c
diff options
context:
space:
mode:
authorPatrik Flykt <patrik.flykt@linux.intel.com>2012-04-24 15:34:30 +0300
committerMarcel Holtmann <marcel@holtmann.org>2012-04-24 16:16:11 +0200
commitcb37eaba3247a50da5ab30628dd48b1cdc2c185b (patch)
tree2b2678bd2b87df39725fc2853fd7b63d21532402 /src/notifier.c
parent0e9bff75220290f7bbf680d0eb1e0ee7209d82aa (diff)
downloadconnman-cb37eaba3247a50da5ab30628dd48b1cdc2c185b.tar.gz
connman-cb37eaba3247a50da5ab30628dd48b1cdc2c185b.tar.bz2
connman-cb37eaba3247a50da5ab30628dd48b1cdc2c185b.zip
notifier: Handle Manager state when exiting online
Service state can transition from online to disconnect like this: 1) old online - new disconnect/association => association 2) old association - new disconnect/disconnect => disconnect Create a separate function for leaving online mode, don't rely on the previous old_state in service_indicate_state(). Fixes BMC#25073
Diffstat (limited to 'src/notifier.c')
-rw-r--r--src/notifier.c16
1 files changed, 10 insertions, 6 deletions
diff --git a/src/notifier.c b/src/notifier.c
index f9905be5..0681aa14 100644
--- a/src/notifier.c
+++ b/src/notifier.c
@@ -171,7 +171,7 @@ void __connman_notifier_connect(enum connman_service_type type)
technology_connected(type, TRUE);
}
-void __connman_notifier_online(enum connman_service_type type)
+void __connman_notifier_enter_online(enum connman_service_type type)
{
DBG("type %d", type);
@@ -179,8 +179,15 @@ void __connman_notifier_online(enum connman_service_type type)
state_changed();
}
-void __connman_notifier_disconnect(enum connman_service_type type,
- enum connman_service_state old_state)
+void __connman_notifier_leave_online(enum connman_service_type type)
+{
+ DBG("type %d", type);
+
+ if (__sync_fetch_and_sub(&online[type], 1) == 1)
+ state_changed();
+}
+
+void __connman_notifier_disconnect(enum connman_service_type type)
{
DBG("type %d", type);
@@ -205,9 +212,6 @@ void __connman_notifier_disconnect(enum connman_service_type type,
break;
}
- if (old_state == CONNMAN_SERVICE_STATE_ONLINE)
- __sync_fetch_and_sub(&online[type], 1);
-
if (__sync_fetch_and_sub(&connected[type], 1) != 1)
return;