kill_tun(data->if_name);
connman_provider_set_data(provider, NULL);
connman_rtnl_remove_watch(data->watch);
- connman_provider_unref(data->provider);
- g_free(data);
oc_exit:
if (state != OC_STATE_READY && state != OC_STATE_DISCONNECT)
CONNMAN_PROVIDER_STATE_IDLE);
connman_provider_set_index(provider, -1);
+ connman_provider_unref(data->provider);
+ g_free(data);
+
connman_task_destroy(task);
}
else
return -EOPNOTSUPP;
- __connman_service_indicate_state(provider->vpn_service,
+ if (provider->vpn_service != NULL)
+ __connman_service_indicate_state(provider->vpn_service,
CONNMAN_SERVICE_STATE_DISCONNECT);
if (err < 0) {
if (err != -EINPROGRESS)
static void unregister_provider(gpointer data)
{
struct connman_provider *provider = data;
+ struct connman_service *service = provider->vpn_service;
DBG("provider %p", provider);
- __connman_service_put(provider->vpn_service);
+ provider->vpn_service = NULL;
+ __connman_service_put(service);
connman_element_unregister(&provider->element);
connman_provider_unref(provider);
if (created == TRUE)
provider_probe(provider);
- provider->vpn_service =
+ if (provider->vpn_service == NULL)
+ provider->vpn_service =
__connman_service_create_from_provider(provider);
if (provider->vpn_service == NULL) {
err = -EOPNOTSUPP;
DBG("can not connect delete provider");
connman_provider_unref(provider);
- if (provider->vpn_service != NULL)
+ if (provider->vpn_service != NULL) {
__connman_service_put(provider->vpn_service);
+ provider->vpn_service = NULL;
+ }
}
return err;
DBG("");
+ if (service == NULL)
+ return;
+
ipconfig = __connman_service_get_ipconfig(service);
if (ipconfig == NULL) {
driver_list = g_slist_remove(driver_list, driver);
}
-static void provider_disconnect(gpointer key, gpointer value,
+static void provider_remove(gpointer key, gpointer value,
gpointer user_data)
{
struct connman_provider *provider = value;
- __connman_provider_disconnect(provider);
+ g_hash_table_remove(provider_hash, provider->identifier);
}
static void provider_offline_mode(connman_bool_t enabled)
DBG("enabled %d", enabled);
if (enabled == TRUE)
- g_hash_table_foreach(provider_hash, provider_disconnect, NULL);
+ g_hash_table_foreach(provider_hash, provider_remove, NULL);
}