diff options
author | Aleksander Morgado <aleksander@lanedo.com> | 2012-03-16 15:37:37 +0100 |
---|---|---|
committer | Aleksander Morgado <aleksander@lanedo.com> | 2012-03-16 15:37:37 +0100 |
commit | 295272196dbdf256a7378066889fc89b855b1777 (patch) | |
tree | 0b0da69334bb00fd8c28cb08f459c9d480221e30 /src | |
parent | 29b955afa29396cb51636ba58193d6ba5d87436c (diff) |
iface-modem-simple: don't request to connect the bearer if already connected
Diffstat (limited to 'src')
-rw-r--r-- | src/mm-iface-modem-simple.c | 18 |
1 files 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", |