Blob Blame History Raw
From a32f0e0e4457d561b1aebaf5e8b3390e7868ef90 Mon Sep 17 00:00:00 2001
From: Lubomir Rintel <lkundrak@v3.sk>
Date: Fri, 3 May 2019 19:36:37 +0200
Subject: [PATCH 4/4] bearer-qmi: don't throw away packet data handles on
 cancellation

If the connection attempt is cancelled, the base bearer will attempt a
disconnection because it could reach the point after it connected the
network. However, for that to work we must not forget the packet data
handles, and the ip client instances.
---
 src/mm-bearer-qmi.c | 13 +++++++++++++
 1 file changed, 13 insertions(+)

diff --git a/src/mm-bearer-qmi.c b/src/mm-bearer-qmi.c
index 10664a8..a5d6d29 100644
--- a/src/mm-bearer-qmi.c
+++ b/src/mm-bearer-qmi.c
@@ -1047,6 +1047,19 @@ connect_context_step (ConnectContext *ctx)
                                          MM_CORE_ERROR,
                                          MM_CORE_ERROR_CANCELLED,
                                          "Connection setup operation has been cancelled");
+        if (ctx->data) {
+            ctx->self->priv->data = g_object_ref (ctx->data);
+            /* If we managed to succeed at connecting, we need to preserve the client
+             * and the handle, so that subsequent disconnection can destroy them. */
+            if (ctx->client_ipv4) {
+                ctx->self->priv->client_ipv4 = g_object_ref (ctx->client_ipv4);
+                ctx->self->priv->packet_data_handle_ipv4 = ctx->packet_data_handle_ipv4;
+            }
+            if (ctx->client_ipv6) {
+                ctx->self->priv->client_ipv6 = g_object_ref (ctx->client_ipv6);
+                ctx->self->priv->packet_data_handle_ipv6 = ctx->packet_data_handle_ipv6;
+            }
+        }
         connect_context_complete_and_free (ctx);
         return;
     }
-- 
1.8.3.1