diff options
author | Mohamed Abbas <mabbas@linux.intel.com> | 2011-01-28 12:36:53 +0100 |
---|---|---|
committer | Samuel Ortiz <sameo@linux.intel.com> | 2011-01-28 12:36:53 +0100 |
commit | c1d9897d3fedd611fb0091d60787aebf8b7b1cda (patch) | |
tree | 5b0f97ae8c0214c2dfdc716359979173c45b3347 /plugins/vpn.c | |
parent | 864c2f1123c8db196c7a9225ba3f5f4851ef8678 (diff) | |
download | connman-c1d9897d3fedd611fb0091d60787aebf8b7b1cda.tar.gz connman-c1d9897d3fedd611fb0091d60787aebf8b7b1cda.tar.bz2 connman-c1d9897d3fedd611fb0091d60787aebf8b7b1cda.zip |
vpn: Allow plugins to report error code
Diffstat (limited to 'plugins/vpn.c')
-rw-r--r-- | plugins/vpn.c | 19 |
1 files changed, 15 insertions, 4 deletions
diff --git a/plugins/vpn.c b/plugins/vpn.c index e1b6404b..4685b513 100644 --- a/plugins/vpn.c +++ b/plugins/vpn.c @@ -107,6 +107,7 @@ void vpn_died(struct connman_task *task, int exit_code, void *user_data) struct connman_provider *provider = user_data; struct vpn_data *data = connman_provider_get_data(provider); int state = data->state; + enum connman_provider_error ret; DBG("provider %p data %p", provider, data); @@ -118,10 +119,20 @@ void vpn_died(struct connman_task *task, int exit_code, void *user_data) connman_rtnl_remove_watch(data->watch); vpn_exit: - if (state != VPN_STATE_READY && state != VPN_STATE_DISCONNECT) - connman_provider_set_state(provider, - CONNMAN_PROVIDER_STATE_FAILURE); - else + if (state != VPN_STATE_READY && state != VPN_STATE_DISCONNECT) { + const char *name; + struct vpn_driver_data *vpn_data; + + name = connman_provider_get_driver_name(provider); + vpn_data = g_hash_table_lookup(driver_hash, name); + if (vpn_data != NULL && + vpn_data->vpn_driver->error_code != NULL) + ret = vpn_data->vpn_driver->error_code(exit_code); + else + ret = CONNMAN_PROVIDER_ERROR_UNKNOWN; + + connman_provider_indicate_error(provider, ret); + } else connman_provider_set_state(provider, CONNMAN_PROVIDER_STATE_IDLE); |