diff options
author | Dan Williams <dcbw@redhat.com> | 2013-10-25 19:33:01 -0500 |
---|---|---|
committer | Dan Williams <dcbw@redhat.com> | 2013-10-31 14:55:32 -0500 |
commit | b3c0756f793f42eed95cc4fc183b189461c188c5 (patch) | |
tree | 19023e1581afa86e2ca6275df9baaf398c0781ce /src/nm-active-connection.c | |
parent | ff7e47a41858881e102ce7c3686962f43d08cce4 (diff) | |
download | NetworkManager-b3c0756f793f42eed95cc4fc183b189461c188c5.tar.gz |
trivial: add logging for ActiveConnection master-ready tracking
Diffstat (limited to 'src/nm-active-connection.c')
-rw-r--r-- | src/nm-active-connection.c | 44 |
1 files changed, 41 insertions, 3 deletions
diff --git a/src/nm-active-connection.c b/src/nm-active-connection.c index b8971b62ff..c2442d46ab 100644 --- a/src/nm-active-connection.c +++ b/src/nm-active-connection.c @@ -87,6 +87,24 @@ static void check_master_ready (NMActiveConnection *self); /****************************************************************/ +static const char * +state_to_string (NMActiveConnectionState state) +{ + switch (state) { + case NM_ACTIVE_CONNECTION_STATE_UNKNOWN: + return "unknown"; + case NM_ACTIVE_CONNECTION_STATE_ACTIVATING: + return "activating"; + case NM_ACTIVE_CONNECTION_STATE_ACTIVATED: + return "activated"; + case NM_ACTIVE_CONNECTION_STATE_DEACTIVATING: + return "deactivating"; + case NM_ACTIVE_CONNECTION_STATE_DEACTIVATED: + return "deactivated"; + } + return "(none)"; +} + NMActiveConnectionState nm_active_connection_get_state (NMActiveConnection *self) { @@ -376,12 +394,18 @@ check_master_ready (NMActiveConnection *self) NMActiveConnectionPrivate *priv = NM_ACTIVE_CONNECTION_GET_PRIVATE (self); NMActiveConnectionState master_state = NM_ACTIVE_CONNECTION_STATE_UNKNOWN; - if (priv->state != NM_ACTIVE_CONNECTION_STATE_ACTIVATING) + if (priv->state != NM_ACTIVE_CONNECTION_STATE_ACTIVATING) { + nm_log_dbg (LOGD_DEVICE, "(%p): not signalling master-ready (not activating)", self); return; - if (!priv->master) + } + if (!priv->master) { + nm_log_dbg (LOGD_DEVICE, "(%p): not signalling master-ready (no master)", self); return; - if (priv->master_ready) + } + if (priv->master_ready) { + nm_log_dbg (LOGD_DEVICE, "(%p): not signalling master-ready (already signaled)", self); return; + } /* ActiveConnetions don't enter the ACTIVATING state until they have a * NMDevice in PREPARE or higher states, so the master active connection's @@ -389,8 +413,13 @@ check_master_ready (NMActiveConnection *self) * or higher states. */ master_state = nm_active_connection_get_state (priv->master); + nm_log_dbg (LOGD_DEVICE, "(%p): master ActiveConnection [%p] state now '%s' (%d)", + self, priv->master, state_to_string (master_state), master_state); + if ( master_state == NM_ACTIVE_CONNECTION_STATE_ACTIVATING || master_state == NM_ACTIVE_CONNECTION_STATE_ACTIVATED) { + nm_log_dbg (LOGD_DEVICE, "(%p): signalling master-ready", self); + priv->master_ready = TRUE; g_object_notify (G_OBJECT (self), NM_ACTIVE_CONNECTION_INT_MASTER_READY); @@ -413,9 +442,15 @@ master_state_cb (NMActiveConnection *master, check_master_ready (self); + nm_log_dbg (LOGD_DEVICE, "(%p): master ActiveConnection [%p] state now '%s' (%d)", + self, master, state_to_string (master_state), master_state); + /* Master is deactivating, so this active connection must also deactivate */ if (self_state < NM_ACTIVE_CONNECTION_STATE_DEACTIVATING && master_state >= NM_ACTIVE_CONNECTION_STATE_DEACTIVATING) { + nm_log_dbg (LOGD_DEVICE, "(%p): master ActiveConnection [%p] '%s' failed", + self, master, nm_active_connection_get_name (master)); + g_signal_handlers_disconnect_by_func (master, (GCallback) master_state_cb, self); @@ -451,6 +486,9 @@ nm_active_connection_set_master (NMActiveConnection *self, NMActiveConnection *m g_return_if_fail (priv->device != nm_active_connection_get_device (master)); } + nm_log_dbg (LOGD_DEVICE, "(%p): master ActiveConnection is [%p] %s", + self, master, nm_active_connection_get_name (master)); + priv->master = g_object_ref (master); g_signal_connect (priv->master, "notify::" NM_ACTIVE_CONNECTION_STATE, |