mirror of
https://gitlab.freedesktop.org/NetworkManager/NetworkManager.git
synced 2025-12-30 21:20:10 +01:00
config: implement reloading of connectivity parameters
(cherry picked from commit b814c3122a)
This commit is contained in:
parent
b18de2309a
commit
244cc0171a
3 changed files with 32 additions and 2 deletions
|
|
@ -596,7 +596,12 @@ nm_config_reload (NMConfig *self)
|
|||
/* reloading configuration means we have to carefully check every single option
|
||||
* that we want to support and take specific actions. */
|
||||
|
||||
/* FIXME: no actual reloading implemented yet */
|
||||
if ( nm_config_data_get_connectivity_interval (old_data) != nm_config_data_get_connectivity_interval (new_data)
|
||||
|| g_strcmp0 (nm_config_data_get_connectivity_uri (old_data), nm_config_data_get_connectivity_uri (new_data))
|
||||
|| g_strcmp0 (nm_config_data_get_connectivity_response (old_data), nm_config_data_get_connectivity_response (new_data))) {
|
||||
nm_log_dbg (LOGD_CORE, "config: reload: change '" NM_CONFIG_CHANGES_CONNECTIVITY "'");
|
||||
g_hash_table_insert (changes, NM_CONFIG_CHANGES_CONNECTIVITY, NULL);
|
||||
}
|
||||
|
||||
if (g_hash_table_size (changes))
|
||||
new_data = g_object_ref (new_data);
|
||||
|
|
|
|||
|
|
@ -40,6 +40,8 @@ G_BEGIN_DECLS
|
|||
/* Signals */
|
||||
#define NM_CONFIG_SIGNAL_CONFIG_CHANGED "config-changed"
|
||||
|
||||
#define NM_CONFIG_CHANGES_CONNECTIVITY "connectivity"
|
||||
|
||||
typedef struct NMConfigCmdLineOptions NMConfigCmdLineOptions;
|
||||
|
||||
struct _NMConfig {
|
||||
|
|
|
|||
|
|
@ -167,6 +167,7 @@ typedef struct {
|
|||
|
||||
GSList *devices;
|
||||
NMState state;
|
||||
NMConfig *config;
|
||||
NMConnectivity *connectivity;
|
||||
|
||||
int ignore_link_added_cb;
|
||||
|
|
@ -464,6 +465,18 @@ active_connection_get_by_path (NMManager *manager, const char *path)
|
|||
|
||||
/************************************************************************/
|
||||
|
||||
static void
|
||||
_config_changed_cb (NMConfig *config, NMConfigData *config_data, GHashTable *changes, NMConfigData *old_data, NMManager *self)
|
||||
{
|
||||
g_object_set (NM_MANAGER_GET_PRIVATE (self)->connectivity,
|
||||
NM_CONNECTIVITY_URI, nm_config_data_get_connectivity_uri (config_data),
|
||||
NM_CONNECTIVITY_INTERVAL, nm_config_data_get_connectivity_interval (config_data),
|
||||
NM_CONNECTIVITY_RESPONSE, nm_config_data_get_connectivity_response (config_data),
|
||||
NULL);
|
||||
}
|
||||
|
||||
/************************************************************************/
|
||||
|
||||
static NMDevice *
|
||||
nm_manager_get_device_by_udi (NMManager *manager, const char *udi)
|
||||
{
|
||||
|
|
@ -4748,7 +4761,13 @@ nm_manager_new (NMSettings *settings,
|
|||
g_signal_connect (priv->policy, "notify::" NM_POLICY_ACTIVATING_IP6_DEVICE,
|
||||
G_CALLBACK (policy_activating_device_changed), singleton);
|
||||
|
||||
config_data = nm_config_get_data (nm_config_get ());
|
||||
priv->config = g_object_ref (nm_config_get ());
|
||||
g_signal_connect (G_OBJECT (priv->config),
|
||||
NM_CONFIG_SIGNAL_CONFIG_CHANGED,
|
||||
G_CALLBACK (_config_changed_cb),
|
||||
singleton);
|
||||
|
||||
config_data = nm_config_get_data (priv->config);
|
||||
priv->connectivity = nm_connectivity_new (nm_config_data_get_connectivity_uri (config_data),
|
||||
nm_config_data_get_connectivity_interval (config_data),
|
||||
nm_config_data_get_connectivity_response (config_data));
|
||||
|
|
@ -5072,6 +5091,10 @@ dispose (GObject *object)
|
|||
g_clear_object (&priv->primary_connection);
|
||||
g_clear_object (&priv->activating_connection);
|
||||
|
||||
if (priv->config) {
|
||||
g_signal_handlers_disconnect_by_func (priv->config, _config_changed_cb, manager);
|
||||
g_clear_object (&priv->config);
|
||||
}
|
||||
if (priv->connectivity) {
|
||||
g_signal_handlers_disconnect_by_func (priv->connectivity, connectivity_changed, manager);
|
||||
g_clear_object (&priv->connectivity);
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue