base-call: fix logic when rejecting calls

Make sure the async task is always finished, even when
mm_base_modem_at_command_finish() returns an error which is not
MM_SERIAL_ERROR_RESPONSE_TIMEOUT.
This commit is contained in:
Aleksander Morgado
2018-06-14 12:06:55 +02:00
committed by Dan Williams
parent 0ac15f6e22
commit 9503af95e2

View File

@@ -717,8 +717,7 @@ call_accept (MMBaseCall *self,
}
/*****************************************************************************/
/* Hangup the CALL */
/* Hangup the call */
static gboolean
call_hangup_finish (MMBaseCall *self,
@@ -739,27 +738,13 @@ call_hangup_ready (MMBaseModem *modem,
self = g_task_get_source_object (task);
mm_base_modem_at_command_finish (modem, res, &error);
if (error) {
if (g_error_matches (error, MM_SERIAL_ERROR, MM_SERIAL_ERROR_RESPONSE_TIMEOUT)) {
g_task_return_error (task, error);
g_object_unref (task);
return;
}
mm_dbg ("Couldn't hangup call : '%s'", error->message);
g_error_free (error);
return;
}
/* Update state */
/* we set it as terminated even if we got an error reported */
mm_base_call_change_state (self, MM_CALL_STATE_TERMINATED, MM_CALL_STATE_REASON_TERMINATED);
if (error) {
if (error)
g_task_return_error (task, error);
g_object_unref (task);
return;
}
else
g_task_return_boolean (task, TRUE);
g_object_unref (task);
}
@@ -772,7 +757,6 @@ call_hangup (MMBaseCall *self,
GTask *task;
task = g_task_new (self, NULL, callback, user_data);
mm_base_modem_at_command (self->priv->modem,
"+CHUP",
2,