core: expose and rename nm_policy_device_recheck_auto_activate_schedule()
Let's simplify this part of the code. This is the first step.
This commit is contained in:
@@ -136,7 +136,6 @@ _PRIV_TO_SELF(NMPolicyPrivate *priv)
|
|||||||
|
|
||||||
static void update_system_hostname(NMPolicy *self, const char *msg);
|
static void update_system_hostname(NMPolicy *self, const char *msg);
|
||||||
static void schedule_activate_all(NMPolicy *self);
|
static void schedule_activate_all(NMPolicy *self);
|
||||||
static void schedule_activate_check(NMPolicy *self, NMDevice *device);
|
|
||||||
static NMDevice *get_default_device(NMPolicy *self, int addr_family);
|
static NMDevice *get_default_device(NMPolicy *self, int addr_family);
|
||||||
|
|
||||||
/*****************************************************************************/
|
/*****************************************************************************/
|
||||||
@@ -1335,7 +1334,8 @@ pending_ac_state_changed(NMActiveConnection *ac, guint state, guint reason, NMPo
|
|||||||
con,
|
con,
|
||||||
NM_SETTINGS_AUTOCONNECT_BLOCKED_REASON_FAILED,
|
NM_SETTINGS_AUTOCONNECT_BLOCKED_REASON_FAILED,
|
||||||
TRUE);
|
TRUE);
|
||||||
schedule_activate_check(self, nm_active_connection_get_device(ac));
|
nm_policy_device_recheck_auto_activate_schedule(self,
|
||||||
|
nm_active_connection_get_device(ac));
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Cleanup */
|
/* Cleanup */
|
||||||
@@ -1444,7 +1444,7 @@ auto_activate_device(NMPolicy *self, NMDevice *device)
|
|||||||
best_connection,
|
best_connection,
|
||||||
NM_SETTINGS_AUTOCONNECT_BLOCKED_REASON_FAILED,
|
NM_SETTINGS_AUTOCONNECT_BLOCKED_REASON_FAILED,
|
||||||
TRUE);
|
TRUE);
|
||||||
schedule_activate_check(self, device);
|
nm_policy_device_recheck_auto_activate_schedule(self, device);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1669,14 +1669,19 @@ sleeping_changed(NMManager *manager, GParamSpec *pspec, gpointer user_data)
|
|||||||
reset_autoconnect_all(self, NULL, FALSE);
|
reset_autoconnect_all(self, NULL, FALSE);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
void
|
||||||
schedule_activate_check(NMPolicy *self, NMDevice *device)
|
nm_policy_device_recheck_auto_activate_schedule(NMPolicy *self, NMDevice *device)
|
||||||
{
|
{
|
||||||
NMPolicyPrivate *priv = NM_POLICY_GET_PRIVATE(self);
|
NMPolicyPrivate *priv;
|
||||||
ActivateData *data;
|
ActivateData *data;
|
||||||
NMActiveConnection *ac;
|
NMActiveConnection *ac;
|
||||||
const CList *tmp_list;
|
const CList *tmp_list;
|
||||||
|
|
||||||
|
g_return_if_fail(NM_IS_POLICY(self));
|
||||||
|
g_return_if_fail(NM_IS_DEVICE(device));
|
||||||
|
|
||||||
|
priv = NM_POLICY_GET_PRIVATE(self);
|
||||||
|
|
||||||
if (nm_manager_get_state(priv->manager) == NM_STATE_ASLEEP)
|
if (nm_manager_get_state(priv->manager) == NM_STATE_ASLEEP)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
@@ -2138,7 +2143,7 @@ device_state_changed(NMDevice *device,
|
|||||||
update_routing_and_dns(self, FALSE, device);
|
update_routing_and_dns(self, FALSE, device);
|
||||||
|
|
||||||
/* Device is now available for auto-activation */
|
/* Device is now available for auto-activation */
|
||||||
schedule_activate_check(self, device);
|
nm_policy_device_recheck_auto_activate_schedule(self, device);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case NM_DEVICE_STATE_PREPARE:
|
case NM_DEVICE_STATE_PREPARE:
|
||||||
@@ -2262,7 +2267,7 @@ device_autoconnect_changed(NMDevice *device, GParamSpec *pspec, gpointer user_da
|
|||||||
NMPolicyPrivate *priv = user_data;
|
NMPolicyPrivate *priv = user_data;
|
||||||
NMPolicy *self = _PRIV_TO_SELF(priv);
|
NMPolicy *self = _PRIV_TO_SELF(priv);
|
||||||
|
|
||||||
schedule_activate_check(self, device);
|
nm_policy_device_recheck_auto_activate_schedule(self, device);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
@@ -2271,7 +2276,7 @@ device_recheck_auto_activate(NMDevice *device, gpointer user_data)
|
|||||||
NMPolicyPrivate *priv = user_data;
|
NMPolicyPrivate *priv = user_data;
|
||||||
NMPolicy *self = _PRIV_TO_SELF(priv);
|
NMPolicy *self = _PRIV_TO_SELF(priv);
|
||||||
|
|
||||||
schedule_activate_check(self, device);
|
nm_policy_device_recheck_auto_activate_schedule(self, device);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
@@ -2532,7 +2537,7 @@ schedule_activate_all_cb(gpointer user_data)
|
|||||||
priv->schedule_activate_all_id = 0;
|
priv->schedule_activate_all_id = 0;
|
||||||
|
|
||||||
nm_manager_for_each_device (priv->manager, device, tmp_lst)
|
nm_manager_for_each_device (priv->manager, device, tmp_lst)
|
||||||
schedule_activate_check(self, device);
|
nm_policy_device_recheck_auto_activate_schedule(self, device);
|
||||||
|
|
||||||
return G_SOURCE_REMOVE;
|
return G_SOURCE_REMOVE;
|
||||||
}
|
}
|
||||||
|
@@ -34,6 +34,8 @@ NMActiveConnection *nm_policy_get_activating_ip6_ac(NMPolicy *policy);
|
|||||||
|
|
||||||
void nm_policy_unblock_failed_ovs_interfaces(NMPolicy *self);
|
void nm_policy_unblock_failed_ovs_interfaces(NMPolicy *self);
|
||||||
|
|
||||||
|
void nm_policy_device_recheck_auto_activate_schedule(NMPolicy *self, NMDevice *device);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* NMPolicyHostnameMode
|
* NMPolicyHostnameMode
|
||||||
* @NM_POLICY_HOSTNAME_MODE_NONE: never update the transient hostname.
|
* @NM_POLICY_HOSTNAME_MODE_NONE: never update the transient hostname.
|
||||||
|
Reference in New Issue
Block a user