summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorDaniel Wagner <daniel.wagner@bmw-carit.de>2012-04-19 11:58:22 +0200
committerMarcel Holtmann <marcel@holtmann.org>2012-04-19 13:38:08 +0200
commitb7a9a8cbd5b5d2e36b6d33d4a150642c7d0cfdcc (patch)
tree4a244afe046b3a35fad9849be7077536ffdb48e2 /src
parent9fe8694282b988d946b62b11a3b771ea2ec30d25 (diff)
downloadconnman-b7a9a8cbd5b5d2e36b6d33d4a150642c7d0cfdcc.tar.gz
connman-b7a9a8cbd5b5d2e36b6d33d4a150642c7d0cfdcc.tar.bz2
connman-b7a9a8cbd5b5d2e36b6d33d4a150642c7d0cfdcc.zip
notifier: Change __connman_notifier_count_connected() to *_is_connected()
No caller is interested in the number of connected services, only if there is one or more or none.
Diffstat (limited to 'src')
-rw-r--r--src/connman.h2
-rw-r--r--src/notifier.c11
-rw-r--r--src/service.c2
3 files changed, 7 insertions, 8 deletions
diff --git a/src/connman.h b/src/connman.h
index 4bf534fc..80afffe5 100644
--- a/src/connman.h
+++ b/src/connman.h
@@ -701,7 +701,7 @@ void __connman_notifier_service_state_changed(struct connman_service *service,
void __connman_notifier_ipconfig_changed(struct connman_service *service,
struct connman_ipconfig *ipconfig);
-unsigned int __connman_notifier_count_connected(void);
+connman_bool_t __connman_notifier_is_connected(void);
const char *__connman_notifier_get_state(void);
#include <connman/rtnl.h>
diff --git a/src/notifier.c b/src/notifier.c
index 7d4b1e89..10f1692d 100644
--- a/src/notifier.c
+++ b/src/notifier.c
@@ -91,17 +91,17 @@ static unsigned int notifier_count_online(void)
return count;
}
-unsigned int __connman_notifier_count_connected(void)
+connman_bool_t __connman_notifier_is_connected(void)
{
- unsigned int i, count = 0;
+ unsigned int i;
__sync_synchronize();
for (i = 0; i < MAX_TECHNOLOGIES; i++) {
if (connected[i] > 0)
- count++;
+ return TRUE;
}
- return count;
+ return FALSE;
}
static const char *evaluate_notifier_state(void)
@@ -112,8 +112,7 @@ static const char *evaluate_notifier_state(void)
if (count > 0)
return "online";
- count = __connman_notifier_count_connected();
- if (count > 0)
+ if (__connman_notifier_is_connected() == TRUE)
return "ready";
if ( __connman_technology_get_offlinemode() == TRUE)
diff --git a/src/service.c b/src/service.c
index 04be98e1..35b7abae 100644
--- a/src/service.c
+++ b/src/service.c
@@ -4549,7 +4549,7 @@ static int service_indicate_state(struct connman_service *service)
} else if (new_state == CONNMAN_SERVICE_STATE_DISCONNECT) {
def_service = __connman_service_get_default();
- if (__connman_notifier_count_connected() == 0 &&
+ if (__connman_notifier_is_connected() == FALSE &&
def_service != NULL &&
def_service->provider != NULL)
__connman_provider_disconnect(def_service->provider);