gprs: Mark context inactive on removal

This commit is contained in:
Denis Kenzior 2011-05-11 12:09:56 -05:00
parent 623183d996
commit 4714d8199a
1 changed files with 26 additions and 0 deletions

View File

@ -2133,12 +2133,38 @@ void ofono_gprs_set_cid_range(struct ofono_gprs *gprs,
static void gprs_context_unregister(struct ofono_atom *atom)
{
struct ofono_gprs_context *gc = __ofono_atom_get_data(atom);
DBusConnection *conn = ofono_dbus_get_connection();
GSList *l;
struct pri_context *ctx;
dbus_bool_t value;
DBG("%p, %p", gc, gc->gprs);
if (gc->gprs == NULL)
goto done;
for (l = gc->gprs->contexts; l; l = l->next) {
ctx = l->data;
if (ctx->context_driver != gc)
continue;
if (ctx->pending != NULL)
__ofono_dbus_pending_reply(&ctx->pending,
__ofono_error_failed(ctx->pending));
if (ctx->active == FALSE)
break;
pri_reset_context_settings(ctx);
release_context(ctx);
value = FALSE;
ofono_dbus_signal_property_changed(conn, ctx->path,
OFONO_CONNECTION_CONTEXT_INTERFACE,
"Active", DBUS_TYPE_BOOLEAN, &value);
}
gc->gprs->context_drivers = g_slist_remove(gc->gprs->context_drivers,
gc);
gc->gprs = NULL;