diff options
author | Marcel Holtmann <marcel@holtmann.org> | 2009-07-24 01:22:43 +0200 |
---|---|---|
committer | Marcel Holtmann <marcel@holtmann.org> | 2009-07-24 01:22:43 +0200 |
commit | 72c68c7c45492cd6c2369f5c0f5b9f36107ea3a0 (patch) | |
tree | 542398a7c7e7dfc735d65b7458017c7c255a26c4 /src | |
parent | 78a5ea52ee75c0c8b029bbe4ad8355e2a10cb01c (diff) | |
download | connman-72c68c7c45492cd6c2369f5c0f5b9f36107ea3a0.tar.gz connman-72c68c7c45492cd6c2369f5c0f5b9f36107ea3a0.tar.bz2 connman-72c68c7c45492cd6c2369f5c0f5b9f36107ea3a0.zip |
Add timeout for technology enable and disable operation
Diffstat (limited to 'src')
-rw-r--r-- | src/manager.c | 25 |
1 files changed, 25 insertions, 0 deletions
diff --git a/src/manager.c b/src/manager.c index e55c6765..c318be13 100644 --- a/src/manager.c +++ b/src/manager.c @@ -391,9 +391,17 @@ static DBusConnection *connection = NULL; static enum connman_service_type technology_type; static connman_bool_t technology_enabled; static DBusMessage *technology_pending = NULL; +static guint technology_timeout = 0; static void technology_reply(int error) { + DBG(""); + + if (technology_timeout > 0) { + g_source_remove(technology_timeout); + technology_timeout = 0; + } + if (technology_reply != NULL) { if (error > 0) { DBusMessage *reply; @@ -413,6 +421,17 @@ static void technology_reply(int error) technology_type = CONNMAN_SERVICE_TYPE_UNKNOWN; } +static gboolean technology_abort(gpointer user_data) +{ + DBG(""); + + technology_timeout = 0; + + technology_reply(ETIMEDOUT); + + return FALSE; +} + static void technology_notify(enum connman_service_type type, connman_bool_t enabled) { @@ -466,6 +485,9 @@ static DBusMessage *enable_technology(DBusConnection *conn, err = __connman_element_enable_technology(type); if (err < 0 && err != -EINPROGRESS) technology_reply(-err); + else + technology_timeout = g_timeout_add_seconds(15, + technology_abort, NULL); return NULL; } @@ -508,6 +530,9 @@ static DBusMessage *disable_technology(DBusConnection *conn, err = __connman_element_disable_technology(type); if (err < 0 && err != -EINPROGRESS) technology_reply(-err); + else + technology_timeout = g_timeout_add_seconds(10, + technology_abort, NULL); return NULL; } |