summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMartin Xu <martin.xu@intel.com>2009-07-11 20:20:13 +0800
committerMarcel Holtmann <marcel@holtmann.org>2009-07-11 12:40:19 -0700
commitbef2354b7cdda736950e2c0a5a63087ad1c0fd47 (patch)
treee487905f0b327e9de5818633f2b0e4b2de216306
parent93dd1f9b16cc364c2aad3a8c2979c4c7d9f5bd31 (diff)
downloadconnman-bef2354b7cdda736950e2c0a5a63087ad1c0fd47.tar.gz
connman-bef2354b7cdda736950e2c0a5a63087ad1c0fd47.tar.bz2
connman-bef2354b7cdda736950e2c0a5a63087ad1c0fd47.zip
Ignore service at auto-connect after user disconnected it
-rw-r--r--src/service.c20
1 files changed, 19 insertions, 1 deletions
diff --git a/src/service.c b/src/service.c
index 47ba5074..da75ca7c 100644
--- a/src/service.c
+++ b/src/service.c
@@ -44,6 +44,7 @@ struct connman_service {
connman_uint8_t strength;
connman_bool_t favorite;
connman_bool_t hidden;
+ connman_bool_t ignore;
GTimeVal modified;
unsigned int order;
char *name;
@@ -453,6 +454,17 @@ static struct connman_service *find_pending_service(void)
return NULL;
}
+static connman_bool_t is_ignore(struct connman_service *service)
+{
+ if (service->ignore == TRUE)
+ return TRUE;
+
+ if (service->state == CONNMAN_SERVICE_STATE_FAILURE)
+ return TRUE;
+
+ return FALSE;
+}
+
static void __connman_service_auto_connect(void)
{
struct connman_service *service;
@@ -470,7 +482,7 @@ static void __connman_service_auto_connect(void)
service = g_sequence_get(iter);
- while (service->state == CONNMAN_SERVICE_STATE_FAILURE) {
+ while (is_ignore(service) == TRUE) {
iter = g_sequence_iter_next(iter);
if (g_sequence_iter_is_end(iter))
return;
@@ -555,6 +567,8 @@ static DBusMessage *connect_service(DBusConnection *conn,
if (service->pending != NULL)
return __connman_error_in_progress(msg);
+ service->ignore = FALSE;
+
service->pending = dbus_message_ref(msg);
err = __connman_service_connect(service);
@@ -596,6 +610,8 @@ static DBusMessage *disconnect_service(DBusConnection *conn,
return g_dbus_create_reply(msg, DBUS_TYPE_INVALID);
}
+ service->ignore = TRUE;
+
err = __connman_service_disconnect(service);
if (err < 0) {
if (err != -EINPROGRESS)
@@ -788,6 +804,8 @@ static void __connman_service_initialize(struct connman_service *service)
service->favorite = FALSE;
service->hidden = FALSE;
+ service->ignore = FALSE;
+
service->order = 0;
}