base-call: fix logic when accepting calls
Don't return FALSE when call is successfully accepted, otherwise the caller will get very confused: ModemManager[19952]: <debug> [1528968478.344338] (ttyACM2): --> 'ATA<CR>' ModemManager[19952]: <debug> [1528968478.361986] (ttyACM2): <-- '<CR><LF>OK<CR><LF>' (ModemManager:19952): GLib-GIO-CRITICAL **: 11:27:58.387: g_dbus_method_invocation_take_error: assertion 'error != NULL' failed And also, 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:

committed by
Dan Williams

parent
fa67a4f9bb
commit
0ac15f6e22
@@ -661,8 +661,7 @@ call_start (MMBaseCall *self,
|
||||
}
|
||||
|
||||
/*****************************************************************************/
|
||||
|
||||
/* Accept the CALL */
|
||||
/* Accept the call */
|
||||
|
||||
static gboolean
|
||||
call_accept_finish (MMBaseCall *self,
|
||||
@@ -684,38 +683,20 @@ call_accept_ready (MMBaseModem *modem,
|
||||
self = g_task_get_source_object (task);
|
||||
|
||||
response = 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 accept call : '%s'", error->message);
|
||||
g_error_free (error);
|
||||
return;
|
||||
}
|
||||
|
||||
/* check response for error */
|
||||
if (response && response[0]) {
|
||||
if (response && response[0])
|
||||
g_set_error (&error, MM_CORE_ERROR, MM_CORE_ERROR_FAILED,
|
||||
"Couldn't accept the call: "
|
||||
"Unhandled response '%s'", response);
|
||||
|
||||
/* Update state */
|
||||
mm_base_call_change_state (self, MM_CALL_STATE_TERMINATED, MM_CALL_STATE_REASON_ERROR);
|
||||
} else {
|
||||
/* Update state */
|
||||
mm_base_call_change_state (self, MM_CALL_STATE_ACTIVE, MM_CALL_STATE_REASON_ACCEPTED);
|
||||
}
|
||||
"Couldn't accept the call: Unhandled response '%s'", response);
|
||||
|
||||
if (error) {
|
||||
mm_base_call_change_state (self, MM_CALL_STATE_TERMINATED, MM_CALL_STATE_REASON_ERROR);
|
||||
g_task_return_error (task, error);
|
||||
g_object_unref (task);
|
||||
return;
|
||||
} else {
|
||||
mm_base_call_change_state (self, MM_CALL_STATE_ACTIVE, MM_CALL_STATE_REASON_ACCEPTED);
|
||||
g_task_return_boolean (task, TRUE);
|
||||
}
|
||||
|
||||
g_task_return_boolean (task, FALSE);
|
||||
g_object_unref (task);
|
||||
}
|
||||
|
||||
@@ -727,7 +708,6 @@ call_accept (MMBaseCall *self,
|
||||
GTask *task;
|
||||
|
||||
task = g_task_new (self, NULL, callback, user_data);
|
||||
|
||||
mm_base_modem_at_command (self->priv->modem,
|
||||
"ATA",
|
||||
2,
|
||||
|
Reference in New Issue
Block a user