policy: recheck activation after connection retries are cleared

After any connection has had its retries cleared, schedule an
activation check so that we can possibly use that connection
again.
This commit is contained in:
Dan Williams
2011-12-06 16:33:00 -06:00
parent 18088e0d07
commit ce9d8a68d7

View File

@@ -76,6 +76,9 @@ struct NMPolicy {
#define RESET_RETRIES_TIMER 300 #define RESET_RETRIES_TIMER 300
#define FAILURE_REASON_TAG "failure-reason" #define FAILURE_REASON_TAG "failure-reason"
static void schedule_activate_all (NMPolicy *policy);
static NMDevice * static NMDevice *
get_best_ip4_device (NMManager *manager, NMActRequest **out_req) get_best_ip4_device (NMManager *manager, NMActRequest **out_req)
{ {
@@ -978,6 +981,7 @@ reset_connections_retries (gpointer user_data)
NMPolicy *policy = (NMPolicy *) user_data; NMPolicy *policy = (NMPolicy *) user_data;
GSList *connections, *iter; GSList *connections, *iter;
time_t con_stamp, min_stamp, now; time_t con_stamp, min_stamp, now;
gboolean changed = FALSE;
policy->reset_retries_id = 0; policy->reset_retries_id = 0;
@@ -990,6 +994,7 @@ reset_connections_retries (gpointer user_data)
if (con_stamp + RESET_RETRIES_TIMER <= now) { if (con_stamp + RESET_RETRIES_TIMER <= now) {
set_connection_auto_retries (NM_CONNECTION (iter->data), RETRIES_DEFAULT); set_connection_auto_retries (NM_CONNECTION (iter->data), RETRIES_DEFAULT);
g_object_set_data (G_OBJECT (iter->data), RESET_RETRIES_TIMESTAMP_TAG, GSIZE_TO_POINTER (0)); g_object_set_data (G_OBJECT (iter->data), RESET_RETRIES_TIMESTAMP_TAG, GSIZE_TO_POINTER (0));
changed = TRUE;
continue; continue;
} }
if (con_stamp < min_stamp) if (con_stamp < min_stamp)
@@ -1000,6 +1005,11 @@ reset_connections_retries (gpointer user_data)
/* Schedule the handler again if there are some stamps left */ /* Schedule the handler again if there are some stamps left */
if (min_stamp != now) if (min_stamp != now)
policy->reset_retries_id = g_timeout_add_seconds (RESET_RETRIES_TIMER - (now - min_stamp), reset_connections_retries, policy); policy->reset_retries_id = g_timeout_add_seconds (RESET_RETRIES_TIMER - (now - min_stamp), reset_connections_retries, policy);
/* If anything changed, try to activate the newly re-enabled connections */
if (changed)
schedule_activate_all (policy);
return FALSE; return FALSE;
} }