diff options
author | Aleksander Morgado <aleksander@aleksander.es> | 2019-12-18 15:54:28 +0100 |
---|---|---|
committer | Dan Williams <dcbw@redhat.com> | 2020-01-06 20:17:08 +0000 |
commit | debec6f650e395eaa722da62ce89dab2d754a059 (patch) | |
tree | 90c1395630ad7e12fd093fc08231cc17df52e900 /src | |
parent | 88983fd1572cc912ad0f905caf172a976f6433f0 (diff) |
iface-modem-3gpp: forced registration is not state
The request for forced registration is an implementation detail of
mm_iface_modem_3gpp_register_in_network(), not part of any state to
keep in the private info.
Diffstat (limited to 'src')
-rw-r--r-- | src/mm-iface-modem-3gpp.c | 11 | ||||
-rw-r--r-- | src/mm-iface-modem-3gpp.h | 1 | ||||
-rw-r--r-- | src/mm-iface-modem-simple.c | 1 |
3 files changed, 7 insertions, 6 deletions
diff --git a/src/mm-iface-modem-3gpp.c b/src/mm-iface-modem-3gpp.c index 7341369f..43141e05 100644 --- a/src/mm-iface-modem-3gpp.c +++ b/src/mm-iface-modem-3gpp.c @@ -41,7 +41,6 @@ typedef struct { MMModem3gppRegistrationState cs; MMModem3gppRegistrationState ps; MMModem3gppRegistrationState eps; - gboolean force_registration; gboolean manual_registration; gchar *manual_registration_operator_id; GCancellable *pending_registration_cancellable; @@ -384,6 +383,7 @@ register_in_network_ready (MMIfaceModem3gpp *self, void mm_iface_modem_3gpp_register_in_network (MMIfaceModem3gpp *self, const gchar *operator_id, + gboolean force_registration, guint max_registration_time, GAsyncReadyCallback callback, gpointer user_data) @@ -437,7 +437,7 @@ mm_iface_modem_3gpp_register_in_network (MMIfaceModem3gpp *self, /* Manual registration requested? */ if (ctx->operator_id) { /* If already registered manually with the requested operator, we're done */ - if (!priv->force_registration && + if (!force_registration && (g_strcmp0 (current_operator_code, ctx->operator_id) == 0) && REG_STATE_IS_REGISTERED (reg_state) && priv->manual_registration) { @@ -451,7 +451,6 @@ mm_iface_modem_3gpp_register_in_network (MMIfaceModem3gpp *self, /* Manual registration to a new operator required */ mm_dbg ("Launching manual network registration (%s)...", ctx->operator_id); - priv->force_registration = FALSE; g_free (priv->manual_registration_operator_id); priv->manual_registration_operator_id = g_strdup (ctx->operator_id); priv->manual_registration = TRUE; @@ -460,7 +459,7 @@ mm_iface_modem_3gpp_register_in_network (MMIfaceModem3gpp *self, else { /* If the modem is already registered and the last time it was asked * automatic registration, we're done */ - if (!priv->force_registration && + if (!force_registration && (current_operator_code || REG_STATE_IS_REGISTERED (reg_state)) && !priv->manual_registration) { mm_dbg ("Already registered automatically in network '%s'," @@ -473,7 +472,6 @@ mm_iface_modem_3gpp_register_in_network (MMIfaceModem3gpp *self, /* Automatic registration to a new operator requested */ mm_dbg ("Launching automatic network registration..."); - priv->force_registration = FALSE; g_clear_pointer (&priv->manual_registration_operator_id, g_free); priv->manual_registration = FALSE; } @@ -515,9 +513,9 @@ mm_iface_modem_3gpp_reregister_in_network (MMIfaceModem3gpp *self, /* Relaunch registration using the last used settings */ priv = get_private (self); - priv->force_registration = TRUE; mm_iface_modem_3gpp_register_in_network (self, priv->manual_registration_operator_id, + TRUE, /* if already registered with same settings, force re-registration */ REREGISTER_IN_NETWORK_TIMEOUT, callback, user_data); @@ -601,6 +599,7 @@ handle_register_auth_ready (MMBaseModem *self, case MM_MODEM_STATE_REGISTERED: mm_iface_modem_3gpp_register_in_network (MM_IFACE_MODEM_3GPP (self), ctx->operator_id, + FALSE, /* if already registered with same settings, do nothing */ 60, (GAsyncReadyCallback)handle_register_ready, ctx); diff --git a/src/mm-iface-modem-3gpp.h b/src/mm-iface-modem-3gpp.h index 973d11de..91976fdc 100644 --- a/src/mm-iface-modem-3gpp.h +++ b/src/mm-iface-modem-3gpp.h @@ -307,6 +307,7 @@ void mm_iface_modem_3gpp_clear_current_operator (MMIfaceMod /* Allow registering in the network */ void mm_iface_modem_3gpp_register_in_network (MMIfaceModem3gpp *self, const gchar *operator_id, + gboolean force_registration, guint max_registration_time, GAsyncReadyCallback callback, gpointer user_data); diff --git a/src/mm-iface-modem-simple.c b/src/mm-iface-modem-simple.c index 50c31a00..a427e617 100644 --- a/src/mm-iface-modem-simple.c +++ b/src/mm-iface-modem-simple.c @@ -154,6 +154,7 @@ check_next_registration (GTask *task) mm_iface_modem_3gpp_register_in_network ( MM_IFACE_MODEM_3GPP (self), ctx->operator_id, + FALSE, /* if already registered with same settings, do nothing */ ctx->max_try_time, (GAsyncReadyCallback)register_in_3gpp_network_ready, task); |