Commit 4b2c810b authored by Dan Williams's avatar Dan Williams

core: clear invalid tag on failed connections when sleeping

So they'll get tried again on wakeup/resume.
parent 5761e328
......@@ -711,6 +711,24 @@ hostname_changed (NMManager *manager, GParamSpec *pspec, gpointer user_data)
update_system_hostname ((NMPolicy *) user_data, NULL);
}
static void
sleeping_changed (NMManager *manager, GParamSpec *pspec, gpointer user_data)
{
gboolean sleeping = FALSE;
GSList *connections, *iter;
g_object_get (G_OBJECT (manager), NM_MANAGER_SLEEPING, &sleeping, NULL);
/* Clear the invalid flag on all connections so they'll get retried on wakeup */
if (sleeping) {
connections = nm_manager_get_connections (manager, NM_CONNECTION_SCOPE_SYSTEM);
connections = g_slist_concat (connections, nm_manager_get_connections (manager, NM_CONNECTION_SCOPE_USER));
for (iter = connections; iter; iter = g_slist_next (iter))
g_object_set_data (G_OBJECT (iter->data), INVALID_TAG, NULL);
g_slist_free (connections);
}
}
static void
schedule_activate_check (NMPolicy *policy, NMDevice *device, guint delay_seconds)
{
......@@ -992,10 +1010,14 @@ nm_policy_new (NMManager *manager, NMVPNManager *vpn_manager)
G_CALLBACK (global_state_changed), policy);
policy->signal_ids = g_slist_append (policy->signal_ids, (gpointer) id);
id = g_signal_connect (manager, "notify::hostname",
id = g_signal_connect (manager, "notify::" NM_MANAGER_HOSTNAME,
G_CALLBACK (hostname_changed), policy);
policy->signal_ids = g_slist_append (policy->signal_ids, (gpointer) id);
id = g_signal_connect (manager, "notify::" NM_MANAGER_SLEEPING,
G_CALLBACK (sleeping_changed), policy);
policy->signal_ids = g_slist_append (policy->signal_ids, (gpointer) id);
id = g_signal_connect (manager, "device-added",
G_CALLBACK (device_added), policy);
policy->signal_ids = g_slist_append (policy->signal_ids, (gpointer) id);
......
......@@ -214,6 +214,7 @@ enum {
/* Not exported */
PROP_HOSTNAME,
PROP_SLEEPING,
LAST_PROP
};
......@@ -2429,6 +2430,8 @@ impl_manager_sleep (NMManager *self, gboolean sleep, GError **error)
}
nm_manager_update_state (self);
g_object_notify (G_OBJECT (self), NM_MANAGER_SLEEPING);
return TRUE;
}
......@@ -2761,6 +2764,9 @@ get_property (GObject *object, guint prop_id,
case PROP_HOSTNAME:
g_value_set_string (value, priv->hostname);
break;
case PROP_SLEEPING:
g_value_set_boolean (value, priv->sleeping);
break;
default:
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
break;
......@@ -2884,6 +2890,14 @@ nm_manager_class_init (NMManagerClass *manager_class)
NULL,
G_PARAM_READABLE | NM_PROPERTY_PARAM_NO_EXPORT));
g_object_class_install_property
(object_class, PROP_SLEEPING,
g_param_spec_boolean (NM_MANAGER_SLEEPING,
"Sleeping",
"Sleeping",
FALSE,
G_PARAM_READABLE | NM_PROPERTY_PARAM_NO_EXPORT));
/* signals */
signals[DEVICE_ADDED] =
g_signal_new ("device-added",
......
......@@ -42,6 +42,7 @@
/* Not exported */
#define NM_MANAGER_HOSTNAME "hostname"
#define NM_MANAGER_SLEEPING "sleeping"
typedef struct {
GObject parent;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment