diff options
author | Dan Williams <dcbw@redhat.com> | 2016-05-11 13:18:12 -0500 |
---|---|---|
committer | Dan Williams <dcbw@redhat.com> | 2016-05-27 12:30:06 -0500 |
commit | ba097f1a434761a5129c07b5e4533e57bda43f3e (patch) | |
tree | b4444c6b12eeb9233f8f73c71dfd1c9892eb04c7 | |
parent | 5c3461ff9c01583ee97a76cbed544144c44627db (diff) | |
download | ModemManager-ba097f1a434761a5129c07b5e4533e57bda43f3e.tar.gz |
broadband-bearer-mbm: connect errors should trigger a disconnect
Otherwise we may leave a bearer connected when ModemManager doesn't
think it's connected. Prevents a CME ERROR 277 loop on connect when
the bearer hasn't been torn down correctly.
-rw-r--r-- | plugins/mbm/mm-broadband-bearer-mbm.c | 38 |
1 files changed, 34 insertions, 4 deletions
diff --git a/plugins/mbm/mm-broadband-bearer-mbm.c b/plugins/mbm/mm-broadband-bearer-mbm.c index 3e868f427..196604644 100644 --- a/plugins/mbm/mm-broadband-bearer-mbm.c +++ b/plugins/mbm/mm-broadband-bearer-mbm.c @@ -139,6 +139,36 @@ dial_3gpp_report_connection_status (gpointer data, ctx->e2nap_status = status; } +static void +connect_error_disconnect_ready (MMBroadbandBearer *self, + GAsyncResult *res, + Dial3gppContext *ctx) +{ + MM_BROADBAND_BEARER_GET_CLASS (self)->disconnect_3gpp_finish ( + self, + res, + NULL); + dial_3gpp_context_complete_and_free (ctx); +} + +static void +connect_error_disconnect_start (Dial3gppContext *ctx) +{ + /* We don't care about connect status anymore */ + if (ctx->self->priv->connect_pending == ctx) + ctx->self->priv->connect_pending = NULL; + + MM_BROADBAND_BEARER_GET_CLASS (ctx->self)->disconnect_3gpp ( + MM_BROADBAND_BEARER (ctx->self), + MM_BROADBAND_MODEM (ctx->modem), + ctx->primary, + NULL, + ctx->data, + ctx->cid, + (GAsyncReadyCallback) connect_error_disconnect_ready, + ctx); +} + static gboolean handle_e2nap_connect_status (Dial3gppContext *ctx) { @@ -181,7 +211,7 @@ connect_poll_ready (MMBaseModem *modem, response = mm_base_modem_at_command_full_finish (modem, res, &error); if (!response) { g_simple_async_result_take_error (ctx->result, error); - dial_3gpp_context_complete_and_free (ctx); + connect_error_disconnect_start (ctx); return; } @@ -217,7 +247,7 @@ connect_poll_cb (Dial3gppContext *ctx) MM_CORE_ERROR, MM_CORE_ERROR_CANCELLED, "Dial operation has been cancelled"); - dial_3gpp_context_complete_and_free (ctx); + connect_error_disconnect_start (ctx); return G_SOURCE_REMOVE; } @@ -231,7 +261,7 @@ connect_poll_cb (Dial3gppContext *ctx) MM_MOBILE_EQUIPMENT_ERROR, MM_MOBILE_EQUIPMENT_ERROR_NETWORK_TIMEOUT, "Connection attempt timed out"); - dial_3gpp_context_complete_and_free (ctx); + connect_error_disconnect_start (ctx); return G_SOURCE_REMOVE; } @@ -260,7 +290,7 @@ activate_ready (MMBaseModem *modem, if (!mm_base_modem_at_command_full_finish (modem, res, &error)) { g_simple_async_result_take_error (ctx->result, error); - dial_3gpp_context_complete_and_free (ctx); + connect_error_disconnect_start (ctx); return; } |