From ee4879d19689957c729317c7c02ae34fd9e1160f Mon Sep 17 00:00:00 2001 From: Denis Kenzior Date: Mon, 25 Oct 2010 16:31:46 -0500 Subject: gprs: Return busy if ops are potentially colliding --- src/gprs.c | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) (limited to 'src') diff --git a/src/gprs.c b/src/gprs.c index b2bf9a5e..d1b7de00 100644 --- a/src/gprs.c +++ b/src/gprs.c @@ -720,6 +720,9 @@ static DBusMessage *pri_set_property(DBusConnection *conn, if (cidmap == NULL) return __ofono_error_not_implemented(msg); + if (ctx->gprs->pending) + return __ofono_error_busy(msg); + if (ctx->pending) return __ofono_error_busy(msg); @@ -1375,6 +1378,9 @@ static DBusMessage *gprs_remove_context(DBusConnection *conn, const char *path; const char *atompath; + if (gprs->pending) + return __ofono_error_busy(msg); + if (!dbus_message_get_args(msg, NULL, DBUS_TYPE_OBJECT_PATH, &path, DBUS_TYPE_INVALID)) return __ofono_error_invalid_args(msg); @@ -1389,6 +1395,10 @@ static DBusMessage *gprs_remove_context(DBusConnection *conn, if (ctx->active) { struct ofono_gprs_context *gc = ctx->context_driver; + /* This context is already being messed with */ + if (ctx->pending) + return __ofono_error_busy(msg); + gprs->pending = dbus_message_ref(msg); gc->driver->deactivate_primary(gc, ctx->context.cid, gprs_deactivate_for_remove, ctx); @@ -1471,6 +1481,8 @@ static DBusMessage *gprs_deactivate_all(DBusConnection *conn, DBusMessage *msg, void *data) { struct ofono_gprs *gprs = data; + GSList *l; + struct pri_context *ctx; if (gprs->pending) return __ofono_error_busy(msg); @@ -1478,6 +1490,13 @@ static DBusMessage *gprs_deactivate_all(DBusConnection *conn, if (!dbus_message_get_args(msg, NULL, DBUS_TYPE_INVALID)) return __ofono_error_invalid_args(msg); + for (l = gprs->contexts; l; l = l->next) { + ctx = l->data; + + if (ctx->pending) + return __ofono_error_busy(msg); + } + gprs->pending = dbus_message_ref(msg); gprs_deactivate_next(gprs); -- cgit v1.2.3