All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] gprs: clean context properly
@ 2020-06-25  9:30 Jimmy Gysens
  2020-06-25 17:05 ` Denis Kenzior
  0 siblings, 1 reply; 2+ messages in thread
From: Jimmy Gysens @ 2020-06-25  9:30 UTC (permalink / raw)
  To: ofono

[-- Attachment #1: Type: text/plain, Size: 2004 bytes --]

After a context is detached, the context is not properly cleared. In
addition to releasing the context:

- Reset the context settings (IP, DNS, interface, ...).
- Signal the Active flag as false.
---
 src/gprs.c | 24 ++++++++++++++++--------
 1 file changed, 16 insertions(+), 8 deletions(-)

diff --git a/src/gprs.c b/src/gprs.c
index d9e24840..00cfb905 100644
--- a/src/gprs.c
+++ b/src/gprs.c
@@ -1573,6 +1573,19 @@ static bool have_read_settings(struct ofono_gprs *gprs)
 	return false;
 }
 
+static void pri_context_signal_active(struct pri_context *ctx)
+{
+	DBusConnection *conn;
+	dbus_bool_t value;
+
+	value = ctx->active;
+	conn = ofono_dbus_get_connection();
+
+	ofono_dbus_signal_property_changed(conn, ctx->path,
+					OFONO_CONNECTION_CONTEXT_INTERFACE,
+					"Active", DBUS_TYPE_BOOLEAN, &value);
+}
+
 static void detach_active_contexts(struct ofono_gprs *gprs)
 {
 	GSList *l;
@@ -1596,7 +1609,9 @@ static void detach_active_contexts(struct ofono_gprs *gprs)
 			gc->driver->detach_shutdown(gc, ctx->context.cid);
 
 		/* Make sure the context is properly cleared */
+		pri_reset_context_settings(ctx);
 		release_context(ctx);
+		pri_context_signal_active(ctx);
 	}
 }
 
@@ -2251,8 +2266,6 @@ static void gprs_deactivate_for_all(const struct ofono_error *error,
 {
 	struct pri_context *ctx = data;
 	struct ofono_gprs *gprs = ctx->gprs;
-	DBusConnection *conn;
-	dbus_bool_t value;
 
 	if (error->type != OFONO_ERROR_TYPE_NO_ERROR) {
 		__ofono_dbus_pending_reply(&gprs->pending,
@@ -2262,12 +2275,7 @@ static void gprs_deactivate_for_all(const struct ofono_error *error,
 
 	pri_reset_context_settings(ctx);
 	release_context(ctx);
-
-	value = ctx->active;
-	conn = ofono_dbus_get_connection();
-	ofono_dbus_signal_property_changed(conn, ctx->path,
-					OFONO_CONNECTION_CONTEXT_INTERFACE,
-					"Active", DBUS_TYPE_BOOLEAN, &value);
+	pri_context_signal_active(ctx);
 
 	gprs_deactivate_next(gprs);
 }
-- 
2.17.1

^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH] gprs: clean context properly
  2020-06-25  9:30 [PATCH] gprs: clean context properly Jimmy Gysens
@ 2020-06-25 17:05 ` Denis Kenzior
  0 siblings, 0 replies; 2+ messages in thread
From: Denis Kenzior @ 2020-06-25 17:05 UTC (permalink / raw)
  To: ofono

[-- Attachment #1: Type: text/plain, Size: 416 bytes --]

Hi Jimmy,

On 6/25/20 4:30 AM, Jimmy Gysens wrote:
> After a context is detached, the context is not properly cleared. In
> addition to releasing the context:
> 
> - Reset the context settings (IP, DNS, interface, ...).
> - Signal the Active flag as false.
> ---
>   src/gprs.c | 24 ++++++++++++++++--------
>   1 file changed, 16 insertions(+), 8 deletions(-)
> 

Applied, thanks.

Regards,
-Denis

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2020-06-25 17:05 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-06-25  9:30 [PATCH] gprs: clean context properly Jimmy Gysens
2020-06-25 17:05 ` Denis Kenzior

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.