Commit ec3a9c06 authored by Thomas Haller's avatar Thomas Haller

firewall: merge branch 'th/firewall-async'

parents 10479531 fb7815df
This diff is collapsed.
......@@ -33,9 +33,7 @@
#define NM_IS_FIREWALL_MANAGER_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), NM_TYPE_FIREWALL_MANAGER))
#define NM_FIREWALL_MANAGER_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), NM_TYPE_FIREWALL_MANAGER, NMFirewallManagerClass))
#define NM_FIREWALL_MANAGER_AVAILABLE "available"
#define NM_FIREWALL_MANAGER_STARTED "started"
#define NM_FIREWALL_MANAGER_STATE_CHANGED "state-changed"
typedef struct _NMFirewallManagerCallId *NMFirewallManagerCallId;
......@@ -46,6 +44,8 @@ GType nm_firewall_manager_get_type (void);
NMFirewallManager *nm_firewall_manager_get (void);
gboolean nm_firewall_manager_get_running (NMFirewallManager *self);
typedef void (*NMFirewallManagerAddRemoveCallback) (NMFirewallManager *self,
NMFirewallManagerCallId call_id,
GError *error,
......
......@@ -71,8 +71,6 @@ typedef struct {
GSList *pending_secondaries;
gulong fw_started_id;
NMSettings *settings;
NMDevice *default_device4, *activating_device4;
......@@ -2058,13 +2056,24 @@ connection_added (NMSettings *settings,
}
static void
firewall_started (NMFirewallManager *manager,
gpointer user_data)
firewall_state_changed (NMFirewallManager *manager,
gboolean initialized_now,
gpointer user_data)
{
NMPolicy *self = (NMPolicy *) user_data;
NMPolicyPrivate *priv = NM_POLICY_GET_PRIVATE (self);
const GSList *iter;
if (initialized_now) {
/* the firewall manager was initializing, but all requests
* so fare were queued and are already sent. No need to
* re-update the firewall zone of the devices. */
return;
}
if (!nm_firewall_manager_get_running (manager))
return;
/* add interface of each device to correct zone */
for (iter = nm_manager_get_devices (priv->manager); iter; iter = g_slist_next (iter))
nm_device_update_firewall_zone (iter->data);
......@@ -2328,9 +2337,8 @@ constructed (GObject *object)
}
priv->firewall_manager = g_object_ref (nm_firewall_manager_get ());
priv->fw_started_id = g_signal_connect (priv->firewall_manager, NM_FIREWALL_MANAGER_STARTED,
G_CALLBACK (firewall_started), self);
g_signal_connect (priv->firewall_manager, NM_FIREWALL_MANAGER_STATE_CHANGED,
G_CALLBACK (firewall_state_changed), self);
priv->dns_manager = g_object_ref (nm_dns_manager_get ());
nm_dns_manager_set_initial_hostname (priv->dns_manager, priv->orig_hostname);
......@@ -2389,8 +2397,7 @@ dispose (GObject *object)
priv->pending_secondaries = NULL;
if (priv->firewall_manager) {
g_assert (priv->fw_started_id);
nm_clear_g_signal_handler (priv->firewall_manager, &priv->fw_started_id);
g_signal_handlers_disconnect_by_func (priv->firewall_manager, firewall_state_changed, self);
g_clear_object (&priv->firewall_manager);
}
......
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