aboutsummaryrefslogtreecommitdiff
path: root/build-aux
diff options
context:
space:
mode:
authorAleksander Morgado <aleksander@aleksander.es>2017-11-25 11:15:54 +0100
committerAleksander Morgado <aleksander@aleksander.es>2017-11-27 12:55:27 +0100
commitcc8587fa012aa6f65e6c47a5a2b8e37d79a9c004 (patch)
treea449b0bd59d091affeb11af56b98fe3e9e1120d0 /build-aux
parent1152cf7e6a4a96d833b6ab0a58c5fc6e3ea54765 (diff)
libqmi-glib,client: new 'client-valid' property
It may happen that the lifecycle of a QmiDevice and its allocated QmiClients is managed in a different place of where the QmiClient commands are run, which may keep a QmiClient reference of its own. In this setup, it may happen that the QmiDevice is closed and all clients released while there are still full QmiClient references around that the client may try to use. When this happens, the client operation didn't fail with an error, instead it would just issue a 'QMI_IS_DEVICE (self)' failed warning and go on. ... [/dev/cdc-wdm0] Releasing 'dms' client with flags 'release-cid'... [/dev/cdc-wdm0] Unregistered 'dms' client with ID '10' [/dev/cdc-wdm0] sent message... <<<<<< RAW: <<<<<< length = 17 <<<<<< data = 01:10:00:00:00:00:00:0C:23:00:05:00:01:02:00:02:0A [/dev/cdc-wdm0] sent generic request (translated)... <<<<<< QMUX: <<<<<< length = 16 <<<<<< flags = 0x00 <<<<<< service = "ctl" <<<<<< client = 0 <<<<<< QMI: <<<<<< flags = "none" <<<<<< transaction = 12 <<<<<< tlv_length = 5 <<<<<< message = "Release CID" (0x0023) <<<<<< TLV: <<<<<< type = "Release Info" (0x01) <<<<<< length = 2 <<<<<< value = 02:0A <<<<<< translated = [ service = 'dms' cid = '10' ] qmi_device_command_full: assertion 'QMI_IS_DEVICE (self)' failed <warn> [062790.772245] checking if connected failed: Transaction timed out <debug> [062793.774332] Couldn't refresh CDMA registration status: 'QMI operation failed: Transaction timed out' <debug> [062793.774398] Couldn't refresh signal quality: 'Transaction timed out' <debug> [062793.774414] Periodic signal checks not rescheduled: disabled qmi_device_command_full: assertion 'QMI_IS_DEVICE (self)' failed <warn> [062795.773381] Reloading stats failed: QMI operation failed: Transaction timed out <warn> [062795.773425] checking if connected failed: Transaction timed out qmi_device_command_full: assertion 'QMI_IS_DEVICE (self)' failed qmi_device_command_full: assertion 'QMI_IS_DEVICE (self)' failed ... We avoid this situation by exposing a new 'client-valid' property that users may check before running any command. This same check is now also internally done by all commands so that we cleanly error out if we detect that the client isn't valid.
Diffstat (limited to 'build-aux')
-rw-r--r--build-aux/qmi-codegen/Client.py5
1 files changed, 5 insertions, 0 deletions
diff --git a/build-aux/qmi-codegen/Client.py b/build-aux/qmi-codegen/Client.py
index 445c862..be51197 100644
--- a/build-aux/qmi-codegen/Client.py
+++ b/build-aux/qmi-codegen/Client.py
@@ -477,6 +477,11 @@ class Client:
template += (
'\n'
' task = g_task_new (self, cancellable, callback, user_data);\n'
+ ' if (!qmi_client_is_valid (QMI_CLIENT (self))) {\n'
+ ' g_task_return_new_error (task, QMI_CORE_ERROR, QMI_CORE_ERROR_WRONG_STATE, "client invalid");\n'
+ ' g_object_unref (task);\n'
+ ' return;\n'
+ ' }\n'
'\n'
' transaction_id = qmi_client_get_next_transaction_id (QMI_CLIENT (self));\n'
'\n'