[PATCH 2/3] altair-lte: refactor code for handling 'data' in DetailedConnectContext
Aleksander Morgado
aleksander at aleksander.es
Fri Jan 3 03:31:10 PST 2014
On 03/01/14 01:00, Ben Chan wrote:
> ---
> plugins/altair/mm-broadband-bearer-altair-lte.c | 42 ++++++++++++-------------
> 1 file changed, 20 insertions(+), 22 deletions(-)
>
Pushed, thanks.
> diff --git a/plugins/altair/mm-broadband-bearer-altair-lte.c b/plugins/altair/mm-broadband-bearer-altair-lte.c
> index 98c8193..f08517b 100644
> --- a/plugins/altair/mm-broadband-bearer-altair-lte.c
> +++ b/plugins/altair/mm-broadband-bearer-altair-lte.c
> @@ -68,7 +68,7 @@ detailed_connect_context_new (MMBroadbandBearer *self,
> ctx->modem = MM_BASE_MODEM (g_object_ref (modem));
> ctx->primary = g_object_ref (primary);
> ctx->secondary = (secondary ? g_object_ref (secondary) : NULL);
> - ctx->data = data;
> + ctx->data = g_object_ref (data);
> /* NOTE:
> * We don't currently support cancelling AT commands, so we'll just check
> * whether the operation is to be cancelled at each step. */
> @@ -86,8 +86,7 @@ detailed_connect_context_complete_and_free (DetailedConnectContext *ctx)
> g_simple_async_result_complete_in_idle (ctx->result);
> g_object_unref (ctx->result);
> g_object_unref (ctx->cancellable);
> - if (ctx->data)
> - g_object_unref (ctx->data);
> + g_object_unref (ctx->data);
> if (ctx->secondary)
> g_object_unref (ctx->secondary);
> g_object_unref (ctx->primary);
> @@ -186,6 +185,7 @@ connect_3gpp (MMBroadbandBearer *self,
> gchar *command, *apn;
> MMBearerProperties *config;
> MMModem3gppRegistrationState registration_state;
> + MMPort *data;
>
> /* There is a known firmware bug that can leave the modem unusable if a
> * connect attempt is made when out of coverage. So, fail without trying.
> @@ -203,28 +203,26 @@ connect_3gpp (MMBroadbandBearer *self,
> return;
> }
>
> - ctx = detailed_connect_context_new (
> - self,
> - modem,
> - primary,
> - secondary,
> - /* Get a 'net' data port */
> - mm_base_modem_get_best_data_port (MM_BASE_MODEM (modem),
> - MM_PORT_TYPE_NET),
> - cancellable,
> - callback,
> - user_data);
> -
> - if (!ctx->data) {
> - g_simple_async_result_set_error (
> - ctx->result,
> - MM_CORE_ERROR,
> - MM_CORE_ERROR_CONNECTED,
> - "Couldn't connect: no available net port available");
> - detailed_connect_context_complete_and_free (ctx);
> + data = mm_base_modem_peek_best_data_port (MM_BASE_MODEM (modem), MM_PORT_TYPE_NET);
> + if (!data) {
> + g_simple_async_report_error_in_idle (G_OBJECT (self),
> + callback,
> + user_data,
> + MM_CORE_ERROR,
> + MM_CORE_ERROR_CONNECTED,
> + "Couldn't connect: no available net port available");
> return;
> }
>
> + ctx = detailed_connect_context_new (self,
> + modem,
> + primary,
> + secondary,
> + data,
> + cancellable,
> + callback,
> + user_data);
> +
> config = mm_bearer_peek_config (MM_BEARER (self));
> apn = mm_at_serial_port_quote_string (mm_bearer_properties_get_apn (config));
> command = g_strdup_printf ("%%APNN=%s",apn);
>
--
Aleksander Morgado
http://aleksander.es
More information about the ModemManager-devel
mailing list