diff options
author | Aleksander Morgado <aleksander@aleksander.es> | 2021-09-08 10:12:20 +0200 |
---|---|---|
committer | Aleksander Morgado <aleksander@aleksander.es> | 2021-09-08 10:12:20 +0200 |
commit | 03b75c85d0a4abe8c1595d9b23d3ae4cb320e2d8 (patch) | |
tree | f209b583ea87166d6e96bc540746292c975a41f6 | |
parent | 15d66197b369384c72675b71ce83758289a87dc4 (diff) | |
download | ModemManager-03b75c85d0a4abe8c1595d9b23d3ae4cb320e2d8.tar.gz |
broadband-modem-qmi: refactor process_get_all_call_info() to avoid handling the GTask
The process_get_all_call_info() was not completing the input GTask on
every possible code path (e.g. when remote party number or call info
wasn't available).
The method is now updated to avoid processing the GTask itself,
instead it will attempt to build the call list and return a GError on
any kind of failure.
-rw-r--r-- | src/mm-broadband-modem-qmi.c | 27 |
1 files changed, 16 insertions, 11 deletions
diff --git a/src/mm-broadband-modem-qmi.c b/src/mm-broadband-modem-qmi.c index 9a4c932fb..e61e487a7 100644 --- a/src/mm-broadband-modem-qmi.c +++ b/src/mm-broadband-modem-qmi.c @@ -9228,10 +9228,11 @@ modem_voice_load_call_list_finish (MMIfaceModemVoice *self, return TRUE; } -static void -process_get_all_call_info (QmiClientVoice *client, - QmiMessageVoiceGetAllCallInfoOutput *output, - GTask *task) +static gboolean +process_get_all_call_info (QmiClientVoice *client, + QmiMessageVoiceGetAllCallInfoOutput *output, + GList **out_call_info_list, + GError **error) { GArray *qmi_remote_party_number_list = NULL; GArray *qmi_call_information_list = NULL; @@ -9243,8 +9244,9 @@ process_get_all_call_info (QmiClientVoice *client, qmi_message_voice_get_all_call_info_output_get_call_information (output, &qmi_call_information_list, NULL); if (!qmi_remote_party_number_list || !qmi_call_information_list) { - mm_obj_dbg (client, "Ignoring Get All Call Status message. Remote party number or call information not available"); - return; + g_set_error (error, MM_CORE_ERROR, MM_CORE_ERROR_INVALID_ARGS, + "Remote party number or call information not available"); + return FALSE; } for (i = 0; i < qmi_call_information_list->len; i++) { @@ -9319,7 +9321,8 @@ process_get_all_call_info (QmiClientVoice *client, } } - g_task_return_pointer (task, call_info_list, (GDestroyNotify)mm_3gpp_call_info_list_free); + *out_call_info_list = call_info_list; + return TRUE; } static void @@ -9329,6 +9332,7 @@ modem_voice_load_call_list_ready (QmiClientVoice *client, { g_autoptr(QmiMessageVoiceGetAllCallInfoOutput) output = NULL; GError *error = NULL; + GList *call_info_list = NULL; /* Parse QMI message */ output = qmi_client_voice_get_all_call_info_finish (client, res, &error); @@ -9337,13 +9341,14 @@ modem_voice_load_call_list_ready (QmiClientVoice *client, g_prefix_error (&error, "QMI operation failed: "); g_task_return_error (task, error); } else if (!qmi_message_voice_get_all_call_info_output_get_result (output, &error)) { + g_prefix_error (&error, "Couldn't run Get All Call Info action: "); + g_task_return_error (task, error); + } else if (!process_get_all_call_info (client, output, &call_info_list, &error)) { g_prefix_error (&error, "Couldn't process Get All Call Info action: "); g_task_return_error (task, error); - } else { - process_get_all_call_info (client, output, task); - } + } else + g_task_return_pointer (task, call_info_list, (GDestroyNotify)mm_3gpp_call_info_list_free); - /* We're done, call list already returned */ g_object_unref (task); } |