broadband-bearer: ensure we close the port even if we got cancelled

When there is an error in the connection attempt we need to close the dialling
port ourselves. In the case where we got an error and we also got cancelled,
we need to make sure that the port gets closed.
This commit is contained in:
Aleksander Morgado
2013-04-04 16:59:19 +02:00
parent 0d20a7c85a
commit bc41dd40cd

View File

@@ -501,6 +501,9 @@ extended_error_ready (MMBaseModem *modem,
{
const gchar *result;
/* Close the dialling port as we got an error */
mm_serial_port_close (MM_SERIAL_PORT (ctx->dial_port));
/* If cancelled, complete */
if (dial_3gpp_context_complete_and_free_if_cancelled (ctx))
return;
@@ -520,9 +523,6 @@ extended_error_ready (MMBaseModem *modem,
ctx->saved_error = NULL;
/* Close the dialling port as we got an error */
mm_serial_port_close (MM_SERIAL_PORT (ctx->dial_port));
/* Done with errors */
dial_3gpp_context_complete_and_free (ctx);
}