mirror of
https://gitlab.freedesktop.org/NetworkManager/NetworkManager.git
synced 2026-05-06 17:18:02 +02:00
core: expose and rename nm_policy_device_recheck_auto_activate_schedule()
Let's simplify this part of the code. This is the first step.
(cherry picked from commit f1c15f0ae7)
This commit is contained in:
parent
72f9cfe8bc
commit
073d3a619f
2 changed files with 17 additions and 10 deletions
|
|
@ -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);
|
||||||
|
|
||||||
/*****************************************************************************/
|
/*****************************************************************************/
|
||||||
|
|
@ -1332,7 +1331,8 @@ pending_ac_state_changed(NMActiveConnection *ac, guint state, guint reason, NMPo
|
||||||
con,
|
con,
|
||||||
NM_SETTINGS_AUTO_CONNECT_BLOCKED_REASON_FAILED,
|
NM_SETTINGS_AUTO_CONNECT_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 */
|
||||||
|
|
@ -1439,7 +1439,7 @@ auto_activate_device(NMPolicy *self, NMDevice *device)
|
||||||
best_connection,
|
best_connection,
|
||||||
NM_SETTINGS_AUTO_CONNECT_BLOCKED_REASON_FAILED,
|
NM_SETTINGS_AUTO_CONNECT_BLOCKED_REASON_FAILED,
|
||||||
TRUE);
|
TRUE);
|
||||||
schedule_activate_check(self, device);
|
nm_policy_device_recheck_auto_activate_schedule(self, device);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -1683,14 +1683,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;
|
||||||
|
|
||||||
|
|
@ -2126,7 +2131,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:
|
||||||
|
|
@ -2248,7 +2253,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
|
||||||
|
|
@ -2257,7 +2262,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
|
||||||
|
|
@ -2518,7 +2523,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.
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue