summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMarcel Holtmann <marcel@holtmann.org>2009-07-06 23:49:24 -0700
committerMarcel Holtmann <marcel@holtmann.org>2009-07-06 23:49:24 -0700
commit878f8bd34ff4478f5c6e857dbd5d7dbc1b8334c4 (patch)
tree6e0eda1e16df63ab8494fccaa35a9b543a724300
parent9344d99693c02b44732883ee1e4451552f6ab4b9 (diff)
downloadconnman-878f8bd34ff4478f5c6e857dbd5d7dbc1b8334c4.tar.gz
connman-878f8bd34ff4478f5c6e857dbd5d7dbc1b8334c4.tar.bz2
connman-878f8bd34ff4478f5c6e857dbd5d7dbc1b8334c4.zip
Check for current state on connect timeout
-rw-r--r--src/service.c27
1 files changed, 24 insertions, 3 deletions
diff --git a/src/service.c b/src/service.c
index a7087be4..5b2c6688 100644
--- a/src/service.c
+++ b/src/service.c
@@ -425,8 +425,29 @@ static gboolean connect_timeout(gpointer user_data)
service->timeout = 0;
- if (service->network != NULL)
+ if (service->network != NULL) {
+ connman_bool_t connected;
+
+ connected = connman_network_get_connected(service->network);
+ if (connected == TRUE) {
+ __connman_service_indicate_state(service,
+ CONNMAN_SERVICE_STATE_READY);
+ return FALSE;
+ }
+
__connman_network_disconnect(service->network);
+ } else if (service->device != NULL) {
+ connman_bool_t disconnected;
+
+ disconnected = connman_device_get_disconnected(service->device);
+ if (disconnected == FALSE) {
+ __connman_service_indicate_state(service,
+ CONNMAN_SERVICE_STATE_READY);
+ return FALSE;
+ }
+
+ __connman_device_disconnect(service->device);
+ }
if (service->pending != NULL) {
DBusMessage *reply;
@@ -437,10 +458,10 @@ static gboolean connect_timeout(gpointer user_data)
dbus_message_unref(service->pending);
service->pending = NULL;
+ }
- __connman_service_indicate_state(service,
+ __connman_service_indicate_state(service,
CONNMAN_SERVICE_STATE_FAILURE);
- }
return FALSE;
}