summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorBjørn Mork <bjorn@mork.no>2020-09-21 13:08:38 +0200
committerBjørn Mork <bjorn@mork.no>2020-09-23 09:41:47 +0200
commite266810e03712ac79b0bf4682c92a4834e216b9b (patch)
tree43006d8c1c47d76d4e67d001ba77c79248b4e0ff /src
parentfeaf875cee6e1a0ed36a495f68edc3810e6c89c8 (diff)
libmbim-glib,proxy: use same transaction id for all fragments
All fragments must have the same transaction id. Signed-off-by: Bjørn Mork <bjorn@mork.no>
Diffstat (limited to 'src')
-rw-r--r--src/libmbim-glib/mbim-device.c10
-rw-r--r--src/libmbim-glib/mbim-device.h13
-rw-r--r--src/libmbim-glib/mbim-proxy.c8
3 files changed, 29 insertions, 2 deletions
diff --git a/src/libmbim-glib/mbim-device.c b/src/libmbim-glib/mbim-device.c
index 42f83f2..221956a 100644
--- a/src/libmbim-glib/mbim-device.c
+++ b/src/libmbim-glib/mbim-device.c
@@ -1768,6 +1768,16 @@ mbim_device_get_next_transaction_id (MbimDevice *self)
/*****************************************************************************/
+guint32
+mbim_device_get_transaction_id (MbimDevice *self)
+{
+ g_return_val_if_fail (MBIM_IS_DEVICE (self), 0);
+
+ return self->priv->transaction_id;
+}
+
+/*****************************************************************************/
+
static gboolean
device_write (MbimDevice *self,
const guint8 *data,
diff --git a/src/libmbim-glib/mbim-device.h b/src/libmbim-glib/mbim-device.h
index 2cbdbf6..4d3f7f1 100644
--- a/src/libmbim-glib/mbim-device.h
+++ b/src/libmbim-glib/mbim-device.h
@@ -383,6 +383,19 @@ gboolean mbim_device_close_force (MbimDevice *self,
guint32 mbim_device_get_next_transaction_id (MbimDevice *self);
/**
+ * mbim_device_get_transaction_id:
+ * @self: A #MbimDevice.
+ *
+ * Acquire the transaction ID of this #MbimDevice without
+ * incrementing the internal transaction ID.
+ *
+ * Returns: the current transaction ID.
+ *
+ * Since: 1.26
+ */
+guint32 mbim_device_get_transaction_id (MbimDevice *self);
+
+/**
* mbim_device_command:
* @self: a #MbimDevice.
* @message: the message to send.
diff --git a/src/libmbim-glib/mbim-proxy.c b/src/libmbim-glib/mbim-proxy.c
index cc05a5f..58b7374 100644
--- a/src/libmbim-glib/mbim-proxy.c
+++ b/src/libmbim-glib/mbim-proxy.c
@@ -1026,8 +1026,12 @@ process_command (MbimProxy *self,
command_type ? command_type : "unknown command type",
command ? command : "unknown command");
- /* replace command transaction id with internal proxy transaction id to avoid collision */
- mbim_message_set_transaction_id (message, mbim_device_get_next_transaction_id (client->device));
+ if (_mbim_message_fragment_get_current (message) == _mbim_message_fragment_get_total (message) - 1)
+ /* replace command transaction id with internal proxy transaction id to avoid collision */
+ mbim_message_set_transaction_id (message, mbim_device_get_next_transaction_id (client->device));
+ else
+ /* avoid incrementing transaction until the last fragment is processed */
+ mbim_message_set_transaction_id (message, mbim_device_get_transaction_id (client->device));
/* The timeout needs to be big enough for any kind of transaction to
* complete, otherwise the remote clients will lose the reply if they