diff options
author | Aleksander Morgado <aleksander@aleksander.es> | 2023-04-17 16:18:09 +0200 |
---|---|---|
committer | Aleksander Morgado <aleksandermj@chromium.org> | 2023-05-03 12:38:43 +0000 |
commit | d906443eeed6c0ebc555d8b399edf841611e77e1 (patch) | |
tree | 2af49f642c7701e3598bd450881303df56ae6ce7 /src/mm-iface-modem-simple.c | |
parent | 200f827d386a15ce096d8dd476b21d09d919d8f0 (diff) |
broadband-modem: explicitly abort ongoing attempt when disabling
Diffstat (limited to 'src/mm-iface-modem-simple.c')
-rw-r--r-- | src/mm-iface-modem-simple.c | 23 |
1 files changed, 17 insertions, 6 deletions
diff --git a/src/mm-iface-modem-simple.c b/src/mm-iface-modem-simple.c index a3609eaf..86ed625b 100644 --- a/src/mm-iface-modem-simple.c +++ b/src/mm-iface-modem-simple.c @@ -65,6 +65,21 @@ get_private (MMIfaceModemSimple *self) } /*****************************************************************************/ +/* Abort ongoing requests, if any */ + +void +mm_iface_modem_simple_abort_ongoing (MMIfaceModemSimple *self) +{ + Private *priv; + + priv = get_private (self); + if (priv->ongoing_connect) { + g_cancellable_cancel (priv->ongoing_connect); + g_clear_object (&priv->ongoing_connect); + } +} + +/*****************************************************************************/ /* Register in either a CDMA or a 3GPP network (or both) */ typedef struct { @@ -1010,7 +1025,6 @@ disconnect_auth_ready (MMBaseModem *self, { g_autoptr(MMBearerList) list = NULL; GError *error = NULL; - Private *priv; if (!mm_base_modem_authorize_finish (self, res, &error)) { g_dbus_method_invocation_take_error (ctx->invocation, error); @@ -1020,11 +1034,8 @@ disconnect_auth_ready (MMBaseModem *self, /* If not disconnecting a specific bearer, also cancel any ongoing * connection attempt. */ - priv = get_private (MM_IFACE_MODEM_SIMPLE (self)); - if (!ctx->bearer_path && priv->ongoing_connect) { - g_cancellable_cancel (priv->ongoing_connect); - g_clear_object (&priv->ongoing_connect); - } + if (!ctx->bearer_path) + mm_iface_modem_simple_abort_ongoing (MM_IFACE_MODEM_SIMPLE (self)); g_object_get (self, MM_IFACE_MODEM_BEARER_LIST, &list, |