From: Marcel Holtmann Date: Tue, 7 Jul 2009 06:49:24 +0000 (-0700) Subject: Check for current state on connect timeout X-Git-Tag: 2.0_alpha~3603 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=878f8bd34ff4478f5c6e857dbd5d7dbc1b8334c4;p=framework%2Fconnectivity%2Fconnman.git Check for current state on connect timeout --- diff --git a/src/service.c b/src/service.c index a7087be..5b2c668 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; }