diff options
author | Denis Kenzior <denkenz@gmail.com> | 2010-10-25 16:31:46 -0500 |
---|---|---|
committer | Denis Kenzior <denkenz@gmail.com> | 2010-10-25 16:32:49 -0500 |
commit | ee4879d19689957c729317c7c02ae34fd9e1160f (patch) | |
tree | 404c20a692dcb80e673daac8155e73d3afde6b8e /src | |
parent | 42dfbc450b52fdaab1e2b78b63045b8931bac6d8 (diff) | |
download | ofono-ee4879d19689957c729317c7c02ae34fd9e1160f.tar.bz2 |
gprs: Return busy if ops are potentially colliding
Diffstat (limited to 'src')
-rw-r--r-- | src/gprs.c | 19 |
1 files changed, 19 insertions, 0 deletions
@@ -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); |