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. --- src/network.c | 18 ++++++++++++++++-- 1 files changed, 16 insertions(+), 2 deletions(-)
diff --git a/src/network.c b/src/network.c index 95aecc7..31e7eaa 100644 --- a/src/network.c +++ b/src/network.c @@ -1056,6 +1056,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); @@ -1073,11 +1074,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); -- 1.7.1 _______________________________________________ connman mailing list connman@connman.net http://lists.connman.net/listinfo/connman