From 13bc593a291a5bb5ff004b553268443b5d2c83aa Mon Sep 17 00:00:00 2001 From: Dan Williams Date: Wed, 10 Mar 2010 16:30:58 -0800 Subject: [PATCH] gsm: ensure PDP context deactivation happens on disconnect The port is still connected until disconnect_done() runs, but by this point we already know it's been disconnected so it's safe to run the CGACT commands. --- src/mm-generic-gsm.c | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/src/mm-generic-gsm.c b/src/mm-generic-gsm.c index e9100b34..cab564ae 100644 --- a/src/mm-generic-gsm.c +++ b/src/mm-generic-gsm.c @@ -1966,13 +1966,19 @@ disconnect_flash_done (MMSerialPort *port, char *command; info->error = mm_modem_check_removed (info->modem, error); - if (info->error) { + /* Ignore NO_CARRIER errors and proceed with the PDP context deactivation */ + if ( info->error + && !g_error_matches (info->error, + MM_MODEM_CONNECT_ERROR, + MM_MODEM_CONNECT_ERROR_NO_CARRIER)) { mm_callback_info_schedule (info); return; } - /* Disconnect the PDP context */ priv = MM_GENERIC_GSM_GET_PRIVATE (info->modem); + mm_port_set_connected (priv->data, FALSE); + + /* Disconnect the PDP context */ if (priv->cid >= 0) command = g_strdup_printf ("+CGACT=0,%d", priv->cid); else { @@ -1980,7 +1986,7 @@ disconnect_flash_done (MMSerialPort *port, command = g_strdup_printf ("+CGACT=0"); } - mm_serial_port_queue_command (port, command, 60, disconnect_cgact_done, info); + mm_serial_port_queue_command (port, command, 3, disconnect_cgact_done, info); g_free (command); }