vpn: kill nm_vpn_manager_get_vpn_connection_for_active()

No longer required now that the manager tracks active connections.
This commit is contained in:
Dan Williams 2012-08-22 17:25:10 -05:00
parent a64127a7c2
commit 3a10f695b3
3 changed files with 7 additions and 51 deletions

View file

@ -4342,28 +4342,15 @@ periodic_update_active_connection_timestamps (gpointer user_data)
{
NMManager *manager = NM_MANAGER (user_data);
NMManagerPrivate *priv = NM_MANAGER_GET_PRIVATE (manager);
GPtrArray *active;
int i;
GSList *iter;
active = get_active_connections (manager, NULL);
for (iter = priv->active_connections; iter; iter = g_slist_next (iter)) {
NMActiveConnection *ac = iter->data;
NMSettingsConnection *connection;
for (i = 0; i < active->len; i++) {
const char *active_path = g_ptr_array_index (active, i);
NMActRequest *req;
NMDevice *device = NULL;
req = nm_manager_get_act_request_by_path (manager, active_path, &device);
if (device && nm_device_get_state (device) == NM_DEVICE_STATE_ACTIVATED)
nm_settings_connection_update_timestamp (NM_SETTINGS_CONNECTION (nm_act_request_get_connection (req)),
(guint64) time (NULL), FALSE);
else {
/* The connection is probably VPN */
NMVPNConnection *vpn_con;
vpn_con = nm_vpn_manager_get_vpn_connection_for_active (priv->vpn_manager, active_path);
if (vpn_con && nm_vpn_connection_get_vpn_state (vpn_con) == NM_VPN_CONNECTION_STATE_ACTIVATED)
nm_settings_connection_update_timestamp (NM_SETTINGS_CONNECTION (nm_vpn_connection_get_connection (vpn_con)),
(guint64) time (NULL), FALSE);
if (nm_active_connection_get_state (ac) == NM_ACTIVE_CONNECTION_STATE_ACTIVATED) {
connection = NM_SETTINGS_CONNECTION (nm_active_connection_get_connection (ac));
nm_settings_connection_update_timestamp (connection, (guint64) time (NULL), FALSE);
}
}

View file

@ -234,34 +234,6 @@ nm_vpn_manager_deactivate_connection (NMVPNManager *self,
return success;
}
NMVPNConnection *
nm_vpn_manager_get_vpn_connection_for_active (NMVPNManager *manager,
const char *active_path)
{
NMVPNManagerPrivate *priv;
GHashTableIter iter;
gpointer data;
GSList *active, *elt;
g_return_val_if_fail (NM_IS_VPN_MANAGER (manager), NULL);
priv = NM_VPN_MANAGER_GET_PRIVATE (manager);
g_hash_table_iter_init (&iter, priv->services);
while (g_hash_table_iter_next (&iter, NULL, &data)) {
active = nm_vpn_service_get_active_connections (NM_VPN_SERVICE (data));
for (elt = active; elt; elt = g_slist_next (elt)) {
NMVPNConnection *vpn = NM_VPN_CONNECTION (elt->data);
const char *ac_path;
ac_path = nm_active_connection_get_path (NM_ACTIVE_CONNECTION (vpn));
if (ac_path && !strcmp (ac_path, active_path))
return vpn;
}
}
return NULL;
}
static char *
service_name_from_file (const char *path)
{

View file

@ -81,7 +81,4 @@ gboolean nm_vpn_manager_deactivate_connection (NMVPNManager *manager,
const char *path,
NMVPNConnectionStateReason reason);
NMVPNConnection *nm_vpn_manager_get_vpn_connection_for_active (NMVPNManager *manager,
const char *active_path);
#endif /* NM_VPN_MANAGER_H */