diff options
author | Richard Röjfors <richard@puffinpack.se> | 2019-08-12 23:31:29 +0200 |
---|---|---|
committer | Denis Kenzior <denkenz@gmail.com> | 2019-08-13 01:41:16 -0500 |
commit | 9a1b490e787bdd162bf81bc54c60e0117b4c64b9 (patch) | |
tree | 0a4b03a6ed0185681905bdf3d1730ce5741f0f07 /src | |
parent | aea2ce4e182e0d59e7a72515443998dffe3627e3 (diff) | |
download | ofono-9a1b490e787bdd162bf81bc54c60e0117b4c64b9.tar.gz |
gprs: Ignore activated contexts during init, list them later
There is an issue if an context gets auto activated early,
then provisioning might not have run yet for instance,
so a "new" context is created, which might be duplicated
by a provisioning context later.
So ignore the activated contexts until gprs is ready,
then it calls the driver to list active contexts.
Diffstat (limited to 'src')
-rw-r--r-- | src/gprs.c | 20 |
1 files changed, 19 insertions, 1 deletions
@@ -1965,7 +1965,12 @@ void ofono_gprs_cid_activated(struct ofono_gprs *gprs, unsigned int cid, struct pri_context *pri_ctx; struct ofono_gprs_context *gc; - DBG(""); + DBG("cid %u", cid); + + if (!__ofono_atom_get_registered(gprs->atom)) { + DBG("cid %u activated before atom registered", cid); + return; + } if (l_uintset_contains(gprs->used_cids, cid)) { DBG("cid %u already activated", cid); @@ -3355,11 +3360,18 @@ remove: storage_sync(imsi, SETTINGS_STORE, gprs->settings); } +static void gprs_list_active_contexts_callback(const struct ofono_error *error, + void *data) +{ + DBG("error = %d", error->type); +} + static void ofono_gprs_finish_register(struct ofono_gprs *gprs) { DBusConnection *conn = ofono_dbus_get_connection(); struct ofono_modem *modem = __ofono_atom_get_modem(gprs->atom); const char *path = __ofono_atom_get_path(gprs->atom); + const struct ofono_gprs_driver *driver = gprs->driver; if (gprs->contexts == NULL) /* Automatic provisioning failed */ add_context(gprs, NULL, OFONO_GPRS_CONTEXT_TYPE_INTERNET); @@ -3383,6 +3395,12 @@ static void ofono_gprs_finish_register(struct ofono_gprs *gprs) netreg_watch, gprs, NULL); __ofono_atom_register(gprs->atom, gprs_unregister); + + /* Find any context activated during init */ + if (driver->list_active_contexts) + driver->list_active_contexts(gprs, + gprs_list_active_contexts_callback, + gprs); } static void spn_read_cb(const char *spn, const char *dc, void *data) |