};
struct oc_data {
+ struct connman_provider *provider;
char *if_name;
unsigned flags;
unsigned int watch;
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:
CONNMAN_PROVIDER_STATE_IDLE);
connman_provider_set_index(provider, -1);
- connman_provider_unref(provider);
connman_task_destroy(task);
}
if (data == NULL)
return -ENOMEM;
+ data->provider = connman_provider_ref(provider);
data->watch = 0;
data->flags = 0;
data->task = NULL;
goto exist_err;
}
- connman_provider_ref(provider);
-
data->state = OC_STATE_CONNECT;
return -EINPROGRESS;
exist_err:
connman_provider_set_index(provider, -1);
connman_provider_set_data(provider, NULL);
+ connman_provider_unref(data->provider);
g_free(data);
return ret;
data->state = OC_STATE_DISCONNECT;
connman_task_stop(data->task);
- connman_provider_unref(provider);
-
return 0;
}
data->watch = 0;
connman_task_stop(data->task);
- connman_provider_unref(provider);
-
g_usleep(G_USEC_PER_SEC);
kill_tun(data->if_name);
return 0;
DBG("provider %p", provider);
- __connman_provider_disconnect(provider);
+ __connman_service_put(provider->vpn_service);
connman_element_unregister(&provider->element);
connman_provider_unref(provider);
g_free(provider->domain);
g_free(provider->identifier);
g_free(provider->dns);
- __connman_service_put(provider->vpn_service);
}
static void __connman_provider_initialize(struct connman_provider *provider)
if (service->network != NULL)
connman_network_unref(service->network);
+ if (service->provider != NULL)
+ connman_provider_unref(service->provider);
+
if (service->ipconfig != NULL) {
connman_ipconfig_unref(service->ipconfig);
service->ipconfig = NULL;
return NULL;
service->type = CONNMAN_SERVICE_TYPE_VPN;
- service->provider = provider;
+ service->provider = connman_provider_ref(provider);
service->autoconnect = FALSE;
service->state = CONNMAN_SERVICE_STATE_IDLE;