From: Dragos Tatulea <dragos@endocode.com>
To: ofono@ofono.org
Subject: [PATCH] gprs: lte: set attached after successful activation
Date: Tue, 22 Nov 2016 16:03:47 +0100 [thread overview]
Message-ID: <1479827027-13985-1-git-send-email-dragos@endocode.com> (raw)
[-- Attachment #1: Type: text/plain, Size: 3108 bytes --]
Otherwise the attached state gets to be set before the actual LTE
automatic context is ready. This triggers a race between connman
and ofono: connman sees status attached before the context is active
so connman will try to activate another context with same apn and will
fail over and over again.
---
src/gprs.c | 52 +++++++++++++++++++++++++++-------------------------
1 file changed, 27 insertions(+), 25 deletions(-)
diff --git a/src/gprs.c b/src/gprs.c
index 5f7620b..c5fda35 100644
--- a/src/gprs.c
+++ b/src/gprs.c
@@ -959,6 +959,24 @@ static void pri_deactivate_callback(const struct ofono_error *error, void *data)
}
}
+static void gprs_set_attached_property(struct ofono_gprs *gprs,
+ ofono_bool_t attached)
+{
+ const char *path;
+ DBusConnection *conn = ofono_dbus_get_connection();
+ dbus_bool_t value = attached;
+
+ if (gprs->attached == attached)
+ return;
+
+ gprs->attached = attached;
+
+ path = __ofono_atom_get_path(gprs->atom);
+ ofono_dbus_signal_property_changed(conn, path,
+ OFONO_CONNECTION_MANAGER_INTERFACE,
+ "Attached", DBUS_TYPE_BOOLEAN, &value);
+}
+
static void pri_read_settings_callback(const struct ofono_error *error,
void *data)
{
@@ -987,6 +1005,9 @@ static void pri_read_settings_callback(const struct ofono_error *error,
}
value = pri_ctx->active;
+
+ gprs_set_attached_property(pri_ctx->gprs, TRUE);
+
ofono_dbus_signal_property_changed(conn, pri_ctx->path,
OFONO_CONNECTION_CONTEXT_INTERFACE,
"Active", DBUS_TYPE_BOOLEAN, &value);
@@ -1596,24 +1617,6 @@ static void release_active_contexts(struct ofono_gprs *gprs)
}
}
-static void gprs_set_attached_property(struct ofono_gprs *gprs,
- ofono_bool_t attached)
-{
- const char *path;
- DBusConnection *conn = ofono_dbus_get_connection();
- dbus_bool_t value = attached;
-
- if (gprs->attached == attached)
- return;
-
- gprs->attached = attached;
-
- path = __ofono_atom_get_path(gprs->atom);
- ofono_dbus_signal_property_changed(conn, path,
- OFONO_CONNECTION_MANAGER_INTERFACE,
- "Attached", DBUS_TYPE_BOOLEAN, &value);
-}
-
static void gprs_attached_update(struct ofono_gprs *gprs)
{
ofono_bool_t attached;
@@ -1644,8 +1647,6 @@ static void gprs_attached_update(struct ofono_gprs *gprs)
gprs->flags |= GPRS_FLAG_ATTACHED_UPDATE;
return;
}
-
- gprs_set_attached_property(gprs, attached);
}
static void registration_status_cb(const struct ofono_error *error,
@@ -1717,11 +1718,12 @@ static void gprs_netreg_update(struct ofono_gprs *gprs)
DBG("attach: %u, driver_attached: %u", attach, gprs->driver_attached);
if (ofono_netreg_get_technology(gprs->netreg) ==
- ACCESS_TECHNOLOGY_EUTRAN) {
- /* Ignore attach logic for LTE. There is no such concept. */
- gprs_set_attached_property(gprs, attach);
- return;
- }
+ ACCESS_TECHNOLOGY_EUTRAN)
+ /*
+ * For LTE we set attached status only on successful
+ * context activation.
+ */
+ return;
if (gprs->driver_attached == attach)
return;
--
2.7.4
next reply other threads:[~2016-11-22 15:03 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-11-22 15:03 Dragos Tatulea [this message]
2016-11-22 16:37 ` [PATCH] gprs: lte: set attached after successful activation Denis Kenzior
2016-11-22 16:43 ` Dragos Tatulea
-- strict thread matches above, loose matches on Subject: below --
2016-11-22 16:48 Dragos Tatulea
2016-11-22 16:51 ` Denis Kenzior
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1479827027-13985-1-git-send-email-dragos@endocode.com \
--to=dragos@endocode.com \
--cc=ofono@ofono.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox