aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorAleksander Morgado <aleksander@aleksander.es>2021-12-17 11:16:54 +0100
committerAleksander Morgado <aleksander@aleksander.es>2021-12-26 11:02:45 +0100
commit3fac73a113bcfcca6a68ac24f44c15e0d1ea0d2d (patch)
treef0cea0842b8b3403d4556c4ea8695c3974485d72 /src
parent1ffd693f54ce71ec357b1f574d8340d66fd7bcd9 (diff)
iface-modem-simple: explicit short wait after enabling
When we have just enabled, we want to give it some time before starting the registration process, so that any pending registration update that may have been scheduled during the enabling phase is applied. We don't want to trigger a new automatic registration if e.g. we're already registered.
Diffstat (limited to 'src')
-rw-r--r--src/mm-iface-modem-simple.c21
1 files changed, 21 insertions, 0 deletions
diff --git a/src/mm-iface-modem-simple.c b/src/mm-iface-modem-simple.c
index 57ee18ed..e7746f54 100644
--- a/src/mm-iface-modem-simple.c
+++ b/src/mm-iface-modem-simple.c
@@ -215,6 +215,7 @@ typedef enum {
CONNECTION_STEP_WAIT_FOR_INITIALIZED,
CONNECTION_STEP_ENABLE,
CONNECTION_STEP_WAIT_FOR_ENABLED,
+ CONNECTION_STEP_WAIT_AFTER_ENABLED,
CONNECTION_STEP_REGISTER,
CONNECTION_STEP_BEARER,
CONNECTION_STEP_CONNECT,
@@ -331,6 +332,15 @@ register_in_3gpp_or_cdma_network_ready (MMIfaceModemSimple *self,
connection_step (ctx);
}
+static gboolean
+wait_after_enabled_ready (ConnectionContext *ctx)
+{
+ /* Just go on now */
+ ctx->step++;
+ connection_step (ctx);
+ return G_SOURCE_REMOVE;
+}
+
static void
wait_for_enabled_ready (MMIfaceModem *self,
GAsyncResult *res,
@@ -561,6 +571,17 @@ connection_step (ConnectionContext *ctx)
ctx);
return;
+ case CONNECTION_STEP_WAIT_AFTER_ENABLED:
+ mm_obj_info (ctx->self, "simple connect state (%d/%d): wait after enabled",
+ ctx->step, CONNECTION_STEP_LAST);
+ /* When we have just enabled, we want to give it some time before starting
+ * the registration process, so that any pending registration update that may
+ * have been scheduled during the enabling phase is applied. We don't want to
+ * trigger a new automatic registration if e.g. we're already registered. */
+ g_timeout_add (100, (GSourceFunc)wait_after_enabled_ready, ctx);
+ return;
+
+
case CONNECTION_STEP_REGISTER:
mm_obj_info (ctx->self, "simple connect state (%d/%d): register",
ctx->step, CONNECTION_STEP_LAST);