diff options
author | Thomas Haller <thaller@redhat.com> | 2016-01-19 22:00:53 +0100 |
---|---|---|
committer | Thomas Haller <thaller@redhat.com> | 2016-01-21 14:58:55 +0100 |
commit | 063f9185b95336c269c2b32484e2f6aeaae85d11 (patch) | |
tree | adf77ca21c5211cc81abe01b744c80247650cd7c /src/supplicant-manager | |
parent | 5d64da1da283f5718f06cbd2b7bd2e8d755d168e (diff) |
supplicant: don't pass start_now argument to nm_supplicant_interface_new()
Also, don't only consider the @die_count whether to start the supplicant,
but check for is_available() -- which already considers @die_count and
@running.
Diffstat (limited to 'src/supplicant-manager')
-rw-r--r-- | src/supplicant-manager/nm-supplicant-interface.c | 6 | ||||
-rw-r--r-- | src/supplicant-manager/nm-supplicant-interface.h | 3 | ||||
-rw-r--r-- | src/supplicant-manager/nm-supplicant-manager.c | 40 |
3 files changed, 22 insertions, 27 deletions
diff --git a/src/supplicant-manager/nm-supplicant-interface.c b/src/supplicant-manager/nm-supplicant-interface.c index d49cb4e7e..fedcf2d24 100644 --- a/src/supplicant-manager/nm-supplicant-interface.c +++ b/src/supplicant-manager/nm-supplicant-interface.c @@ -1425,8 +1425,7 @@ NMSupplicantInterface * nm_supplicant_interface_new (const char *ifname, gboolean is_wireless, gboolean fast_supported, - NMSupplicantFeature ap_support, - gboolean start_now) + NMSupplicantFeature ap_support) { NMSupplicantInterface *self; NMSupplicantInterfacePrivate *priv; @@ -1441,9 +1440,6 @@ nm_supplicant_interface_new (const char *ifname, priv->fast_supported = fast_supported; priv->ap_support = ap_support; - if (start_now) - interface_add (self); - return self; } diff --git a/src/supplicant-manager/nm-supplicant-interface.h b/src/supplicant-manager/nm-supplicant-interface.h index d0063d1f4..7f4856633 100644 --- a/src/supplicant-manager/nm-supplicant-interface.h +++ b/src/supplicant-manager/nm-supplicant-interface.h @@ -119,8 +119,7 @@ GType nm_supplicant_interface_get_type (void); NMSupplicantInterface * nm_supplicant_interface_new (const char *ifname, gboolean is_wireless, gboolean fast_supported, - NMSupplicantFeature ap_support, - gboolean start_now); + NMSupplicantFeature ap_support); void nm_supplicant_interface_set_supplicant_available (NMSupplicantInterface *self, gboolean available); diff --git a/src/supplicant-manager/nm-supplicant-manager.c b/src/supplicant-manager/nm-supplicant-manager.c index 776bef934..ac2b1fb86 100644 --- a/src/supplicant-manager/nm-supplicant-manager.c +++ b/src/supplicant-manager/nm-supplicant-manager.c @@ -59,6 +59,17 @@ die_count_exceeded (guint32 count) return count > 2; } +static gboolean +is_available (NMSupplicantManager *self) +{ + NMSupplicantManagerPrivate *priv = NM_SUPPLICANT_MANAGER_GET_PRIVATE (self); + + return priv->running + && !die_count_exceeded (priv->die_count); +} + +/********************************************************************/ + NMSupplicantInterface * nm_supplicant_manager_iface_get (NMSupplicantManager * self, const char *ifname, @@ -66,7 +77,6 @@ nm_supplicant_manager_iface_get (NMSupplicantManager * self, { NMSupplicantManagerPrivate *priv; NMSupplicantInterface *iface = NULL; - gboolean start_now; g_return_val_if_fail (NM_IS_SUPPLICANT_MANAGER (self), NULL); g_return_val_if_fail (ifname != NULL, NULL); @@ -75,22 +85,22 @@ nm_supplicant_manager_iface_get (NMSupplicantManager * self, iface = g_hash_table_lookup (priv->ifaces, ifname); if (!iface) { - /* If we're making the supplicant take a time out for a bit, don't - * let the supplicant interface start immediately, just let it hang - * around in INIT state until we're ready to talk to the supplicant - * again. - */ - start_now = !die_count_exceeded (priv->die_count); - nm_log_dbg (LOGD_SUPPLICANT, "(%s): creating new supplicant interface", ifname); iface = nm_supplicant_interface_new (ifname, is_wireless, priv->fast_supported, - priv->ap_support, - start_now); + priv->ap_support); g_hash_table_insert (priv->ifaces, (char *) nm_supplicant_interface_get_ifname (iface), iface); + + /* If we're making the supplicant take a time out for a bit, don't + * let the supplicant interface start immediately, just let it hang + * around in INIT state until we're ready to talk to the supplicant + * again. + */ + if (is_available (self)) + nm_supplicant_interface_set_supplicant_available (iface, TRUE); } else { nm_log_dbg (LOGD_SUPPLICANT, "(%s): returning existing supplicant interface", ifname); } @@ -203,16 +213,6 @@ availability_changed (NMSupplicantManager *self, gboolean available) g_list_free_full (ifaces, g_object_unref); } -static gboolean -is_available (NMSupplicantManager *self) -{ - g_return_val_if_fail (NM_IS_SUPPLICANT_MANAGER (self), FALSE); - - if (die_count_exceeded (NM_SUPPLICANT_MANAGER_GET_PRIVATE (self)->die_count)) - return FALSE; - return NM_SUPPLICANT_MANAGER_GET_PRIVATE (self)->running; -} - static void set_running (NMSupplicantManager *self, gboolean now_running) { |