From: Jukka Rissanen Date: Wed, 24 Aug 2011 14:01:57 +0000 (+0300) Subject: network: Change the service disconnect state when necessary X-Git-Tag: 0.78~285 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=b5a6920355da765f9c6e699c1b24e74a625e8660;p=platform%2Fupstream%2Fconnman.git network: Change the service disconnect state when necessary If we are in idle or failure states, then we should not change to disconnect state when the service is disconnected. This is because we were not connected in the first place. --- diff --git a/src/network.c b/src/network.c index d360282..5fdc43c 100644 --- a/src/network.c +++ b/src/network.c @@ -1058,6 +1058,7 @@ static gboolean set_connected(gpointer user_data) } else { struct connman_service *service; + enum connman_service_state state; __connman_device_set_network(network->device, NULL); @@ -1075,11 +1076,24 @@ static gboolean set_connected(gpointer user_data) break; } - __connman_service_ipconfig_indicate_state(service, + /* + * We only set the disconnect state if we were not in idle + * or in failure. It does not make sense to go to disconnect + * state if we were not connected. + */ + state = __connman_service_ipconfig_get_state(service, + CONNMAN_IPCONFIG_TYPE_IPV4); + if (state != CONNMAN_SERVICE_STATE_IDLE && + state != CONNMAN_SERVICE_STATE_FAILURE) + __connman_service_ipconfig_indicate_state(service, CONNMAN_SERVICE_STATE_DISCONNECT, CONNMAN_IPCONFIG_TYPE_IPV4); - __connman_service_ipconfig_indicate_state(service, + state = __connman_service_ipconfig_get_state(service, + CONNMAN_IPCONFIG_TYPE_IPV6); + if (state != CONNMAN_SERVICE_STATE_IDLE && + state != CONNMAN_SERVICE_STATE_FAILURE) + __connman_service_ipconfig_indicate_state(service, CONNMAN_SERVICE_STATE_DISCONNECT, CONNMAN_IPCONFIG_TYPE_IPV6);