aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--include/afb-req-itf.h2
-rw-r--r--plugins/samples/ClientCtx.c6
-rw-r--r--src/afb-apis.c3
3 files changed, 5 insertions, 6 deletions
diff --git a/include/afb-req-itf.h b/include/afb-req-itf.h
index a9b768db..8d869a6f 100644
--- a/include/afb-req-itf.h
+++ b/include/afb-req-itf.h
@@ -37,7 +37,7 @@ struct afb_req_itf {
struct afb_req {
const struct afb_req_itf *itf;
void *data;
- void *context;
+ void **context;
};
static inline struct afb_arg afb_req_get(struct afb_req req, const char *name)
diff --git a/plugins/samples/ClientCtx.c b/plugins/samples/ClientCtx.c
index 3fa43adf..0ea88087 100644
--- a/plugins/samples/ClientCtx.c
+++ b/plugins/samples/ClientCtx.c
@@ -75,7 +75,7 @@ static void myCreate (struct afb_req request)
ctx->count = 0;
ctx->abcd = "SomeThingUseful";
- request.context = ctx;
+ *request.context = ctx;
afb_req_success_f(request, NULL, "SUCCESS: create client context for plugin [%s]", handle->anythingYouWant);
}
@@ -86,7 +86,7 @@ static void myCreate (struct afb_req request)
static void myAction (struct afb_req request)
{
MyPluginHandleT *handle = (MyPluginHandleT*) &global_handle;
- MyClientContextT *ctx = (MyClientContextT*) request.context;
+ MyClientContextT *ctx = (MyClientContextT*) *request.context;
// store something in our plugin private client context
ctx->count++;
@@ -100,7 +100,7 @@ static void myAction (struct afb_req request)
static void myClose (struct afb_req request)
{
MyPluginHandleT *handle = (MyPluginHandleT*) &global_handle;
- MyClientContextT *ctx = (MyClientContextT*) request.context;
+ MyClientContextT *ctx = (MyClientContextT*) *request.context;
// store something in our plugin private client context
ctx->count++;
diff --git a/src/afb-apis.c b/src/afb-apis.c
index 8dfac519..55e68c93 100644
--- a/src/afb-apis.c
+++ b/src/afb-apis.c
@@ -367,9 +367,8 @@ int afb_apis_handle(struct afb_req req, struct AFB_clientCtx *context, const cha
v = a->plugin->apis;
for (j = 0 ; v->name ; j++, v++) {
if (!strncasecmp(v->name, verb, lenverb) && !v->name[lenverb]) {
- req.context = context->contexts[i];
+ req.context = &context->contexts[i];
handle(req, v);
- context->contexts[i] = req.context;
return 1;
}
}