diff options
author | Denis Kenzior <denkenz@gmail.com> | 2010-01-07 14:43:21 -0600 |
---|---|---|
committer | Denis Kenzior <denkenz@gmail.com> | 2010-01-07 14:43:21 -0600 |
commit | 20db7314846909ccbcd35046d4e247a67c86cd36 (patch) | |
tree | a44ddc93fca50be7efc3d5d70473e9ede0d73125 | |
parent | 230bddf30ede8110049b149c844ffad34d140498 (diff) | |
download | ofono-20db7314846909ccbcd35046d4e247a67c86cd36.tar.bz2 |
Make primary context ids persistent
-rw-r--r-- | src/gprs.c | 11 |
1 files changed, 11 insertions, 0 deletions
@@ -1740,6 +1740,13 @@ static gboolean load_context(struct ofono_gprs *gprs, const char *group) gboolean ret = FALSE; struct pri_context *context; enum gprs_context_type type; + unsigned int id; + + if (sscanf(group, "primarycontext%d", &id) != 1) + goto error; + + if (id < 1 || id > MAX_CONTEXTS) + goto error; if ((name = g_key_file_get_string(gprs->settings, group, "Name", NULL)) == NULL) @@ -1787,6 +1794,8 @@ static gboolean load_context(struct ofono_gprs *gprs, const char *group) if ((context = pri_context_create(gprs, name, type)) == NULL) goto error; + idmap_take(gprs->pid_map, id); + context->id = id; strcpy(context->context.username, username); strcpy(context->context.password, password); strcpy(context->context.apn, apn); @@ -1794,6 +1803,8 @@ static gboolean load_context(struct ofono_gprs *gprs, const char *group) if (context_dbus_register(context) == FALSE) goto error; + gprs->last_context_id = id; + gprs->contexts = g_slist_append(gprs->contexts, context); ret = TRUE; |