[PATCH] iface-modem, sim: make SIM interface initialization cancellable
Aleksander Morgado
aleksander at aleksander.es
Sat Jan 11 14:34:23 PST 2014
On 11/01/14 01:55, Ben Chan wrote:
> ---
> src/mm-iface-modem.c | 2 +-
> src/mm-sim.c | 10 ++++++++++
> 2 files changed, 11 insertions(+), 1 deletion(-)
>
Pushed, thanks!
> diff --git a/src/mm-iface-modem.c b/src/mm-iface-modem.c
> index 868df81..5edbbae 100644
> --- a/src/mm-iface-modem.c
> +++ b/src/mm-iface-modem.c
> @@ -4470,7 +4470,7 @@ interface_initialization_step (InitializationContext *ctx)
> * This will try to load any missing property value that couldn't be
> * retrieved before due to having the SIM locked. */
> mm_sim_initialize (sim,
> - NULL, /* TODO: cancellable */
> + ctx->cancellable,
> (GAsyncReadyCallback)sim_reinit_ready,
> ctx);
> g_object_unref (sim);
> diff --git a/src/mm-sim.c b/src/mm-sim.c
> index da667e2..7cd84ff 100644
> --- a/src/mm-sim.c
> +++ b/src/mm-sim.c
> @@ -1468,6 +1468,16 @@ STR_REPLY_READY_FN (operator_name, "Operator name")
> static void
> interface_initialization_step (InitAsyncContext *ctx)
> {
> + if (g_cancellable_is_cancelled (ctx->cancellable)) {
> + g_simple_async_result_set_error (ctx->result,
> + MM_CORE_ERROR,
> + MM_CORE_ERROR_CANCELLED,
> + "Interface initialization cancelled");
> + g_simple_async_result_complete_in_idle (ctx->result);
> + init_async_context_free (ctx);
> + return;
> + }
> +
> switch (ctx->step) {
> case INITIALIZATION_STEP_FIRST:
> /* Fall down to next step */
>
--
Aleksander Morgado
http://aleksander.es
More information about the ModemManager-devel
mailing list