[network-manager-openvpn/lr/multiple-vpn: 8/8] service: drop use of API that's gone



commit d1bd9b55bdb7999fb9fca6b593e48994874e79d2
Author: Lubomir Rintel <lkundrak v3 sk>
Date:   Tue Oct 13 18:33:10 2015 +0200

    service: drop use of API that's gone
    
    The NM 1.2 snapshot just removed it and does the status transitions on
    _failure() and _disconnect().

 src/nm-openvpn-service.c |   22 ++++------------------
 1 files changed, 4 insertions(+), 18 deletions(-)
---
diff --git a/src/nm-openvpn-service.c b/src/nm-openvpn-service.c
index 08f3104..82a7322 100644
--- a/src/nm-openvpn-service.c
+++ b/src/nm-openvpn-service.c
@@ -585,7 +585,6 @@ nm_openvpn_socket_data_cb (GIOChannel *source, GIOCondition condition, gpointer
 
        if (!handle_management_socket (plugin, source, condition, &failure)) {
                nm_vpn_service_plugin_failure (plugin, failure);
-               nm_vpn_service_plugin_set_state (plugin, NM_VPN_SERVICE_STATE_STOPPED);
                return FALSE;
        }
 
@@ -608,7 +607,6 @@ nm_openvpn_connect_timer_cb (gpointer data)
        if (fd < 0) {
                g_warning ("Could not create management socket");
                nm_vpn_service_plugin_failure (NM_VPN_SERVICE_PLUGIN (plugin), 
NM_VPN_PLUGIN_FAILURE_CONNECT_FAILED);
-               nm_vpn_service_plugin_set_state (NM_VPN_SERVICE_PLUGIN (plugin), 
NM_VPN_SERVICE_STATE_STOPPED);
                goto out;
        }
 
@@ -623,7 +621,6 @@ nm_openvpn_connect_timer_cb (gpointer data)
 
                g_warning ("Could not open management socket");
                nm_vpn_service_plugin_failure (NM_VPN_SERVICE_PLUGIN (plugin), 
NM_VPN_PLUGIN_FAILURE_CONNECT_FAILED);
-               nm_vpn_service_plugin_set_state (NM_VPN_SERVICE_PLUGIN (plugin), 
NM_VPN_SERVICE_STATE_STOPPED);
        } else {
                io_data->socket_channel = g_io_channel_unix_new (fd);
                g_io_channel_set_encoding (io_data->socket_channel, NULL, NULL);
@@ -673,14 +670,8 @@ openvpn_watch_cb (GPid pid, gint status, gpointer user_data)
        priv->pid = 0;
 
        /* OpenVPN doesn't supply useful exit codes :( */
-       switch (error) {
-       case 0:
+       if (error == 0)
                good_exit = TRUE;
-               break;
-       default:
-               failure = NM_VPN_PLUGIN_FAILURE_CONNECT_FAILED;
-               break;
-       }
 
        /* Try to get the last bits of data from openvpn */
        if (priv->io_data && priv->io_data->socket_channel) {
@@ -695,10 +686,10 @@ openvpn_watch_cb (GPid pid, gint status, gpointer user_data)
                }
        }
 
-       if (!good_exit)
+       if (good_exit)
+               nm_vpn_service_plugin_disconnect (plugin, NULL);
+       else
                nm_vpn_service_plugin_failure (plugin, failure);
-
-       nm_vpn_service_plugin_set_state (plugin, NM_VPN_SERVICE_STATE_STOPPED);
 }
 
 static gboolean
@@ -1581,11 +1572,6 @@ _connect_common (NMVpnServicePlugin   *plugin,
        const char *connection_type;
        const char *user_name;
 
-       if (!real_disconnect (plugin, error)) {
-               g_warning ("Could not clean up previous daemon run: %s", (*error)->message);
-               g_clear_error (error);
-       }
-
        s_vpn = nm_connection_get_setting_vpn (connection);
        if (!s_vpn) {
                g_set_error_literal (error,


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]