{
struct session_info *info = session->info;
struct connman_service *service;
- connman_bool_t disconnect;
+ connman_bool_t disconnect, online;
if (info->entry == NULL)
return;
disconnect = explicit_disconnect(session);
+ online = is_connecting(info->entry->state) == TRUE ||
+ is_online(info->entry->state) == TRUE;
+
info->online = FALSE;
info->reason = CONNMAN_SESSION_REASON_UNKNOWN;
info->entry->reason = CONNMAN_SESSION_REASON_UNKNOWN;
service = info->entry->service;
info->entry = NULL;
- if (disconnect == TRUE)
+ if (disconnect == TRUE && online == TRUE)
g_timeout_add_seconds(0, call_disconnect, service);
}