From 295272196dbdf256a7378066889fc89b855b1777 Mon Sep 17 00:00:00 2001 From: Aleksander Morgado Date: Fri, 16 Mar 2012 15:37:37 +0100 Subject: [PATCH] iface-modem-simple: don't request to connect the bearer if already connected --- src/mm-iface-modem-simple.c | 18 ++++++++++++++---- 1 file changed, 14 insertions(+), 4 deletions(-) diff --git a/src/mm-iface-modem-simple.c b/src/mm-iface-modem-simple.c index f1967b65..bfc0e260 100644 --- a/src/mm-iface-modem-simple.c +++ b/src/mm-iface-modem-simple.c @@ -541,10 +541,20 @@ connection_step (ConnectionContext *ctx) mm_info ("Simple connect state (%d/%d): Connect", ctx->step, CONNECTION_STEP_LAST); - mm_bearer_connect (ctx->bearer, - (GAsyncReadyCallback)connect_bearer_ready, - ctx); - return; + /* Wait... if we're already using an existing bearer, we need to check if it is + * already connected; and if so, just don't do anything else */ + if (mm_bearer_get_status (ctx->bearer) != MM_BEARER_STATUS_CONNECTED) { + mm_bearer_connect (ctx->bearer, + (GAsyncReadyCallback)connect_bearer_ready, + ctx); + return; + } + + mm_dbg ("Bearer at '%s' is already connected...", + mm_bearer_get_path (ctx->bearer)); + + /* Fall down to next step */ + ctx->step++; case CONNECTION_STEP_LAST: mm_info ("Simple connect state (%d/%d): All done",