diff options
author | José Bollo <jose.bollo@iot.bzh> | 2016-04-05 16:52:35 +0200 |
---|---|---|
committer | José Bollo <jose.bollo@iot.bzh> | 2016-04-05 16:52:35 +0200 |
commit | 21974dca8364f3d267dd912e92521f6252dddf02 (patch) | |
tree | 5ebbd324135d6ec3216b2fe64806cb5b6c3021b3 | |
parent | f113d2b31333538f5784de5ee5f02bc19cc603e4 (diff) |
renaming of session API
Change-Id: Id9113a4e14da296d929fed0fd2f1dd7cfeba839b
Signed-off-by: José Bollo <jose.bollo@iot.bzh>
-rw-r--r-- | src/afb-hreq.c | 2 | ||||
-rw-r--r-- | src/afb-hsrv.c | 1 | ||||
-rw-r--r-- | src/session.c | 9 | ||||
-rw-r--r-- | src/session.h | 3 |
4 files changed, 12 insertions, 3 deletions
diff --git a/src/afb-hreq.c b/src/afb-hreq.c index 087a27ce..ece9b399 100644 --- a/src/afb-hreq.c +++ b/src/afb-hreq.c @@ -562,7 +562,7 @@ struct AFB_clientCtx *afb_hreq_context(struct afb_hreq *hreq) uuid = afb_hreq_get_argument(hreq, uuid_arg); if (uuid == NULL) uuid = afb_hreq_get_cookie(hreq, uuid_cookie); - hreq->context = ctxClientGet(uuid); + hreq->context = ctxClientGetForUuid(uuid); } return hreq->context; } diff --git a/src/afb-hsrv.c b/src/afb-hsrv.c index b5e6887b..2c294399 100644 --- a/src/afb-hsrv.c +++ b/src/afb-hsrv.c @@ -29,6 +29,7 @@ #include "local-def.h" #include "afb-method.h" #include "afb-hreq.h" +#include "afb-hsrv.h" #include "afb-websock.h" #include "afb-apis.h" #include "afb-req-itf.h" diff --git a/src/session.c b/src/session.c index e9cf298e..da2294bc 100644 --- a/src/session.c +++ b/src/session.c @@ -168,7 +168,7 @@ static void ctxStoreCleanUp (time_t now) } // This function will return exiting client context or newly created client context -struct AFB_clientCtx *ctxClientGet (const char *uuid) +struct AFB_clientCtx *ctxClientGetForUuid (const char *uuid) { uuid_t newuuid; struct AFB_clientCtx *clientCtx; @@ -215,6 +215,13 @@ struct AFB_clientCtx *ctxClientGet (const char *uuid) return NULL; } +struct AFB_clientCtx *ctxClientGet(struct AFB_clientCtx *clientCtx) +{ + if (clientCtx != NULL) + clientCtx->refcount++; + return clientCtx; +} + void ctxClientPut(struct AFB_clientCtx *clientCtx) { if (clientCtx != NULL) { diff --git a/src/session.h b/src/session.h index 28f25991..10af74fd 100644 --- a/src/session.h +++ b/src/session.h @@ -28,7 +28,8 @@ struct AFB_clientCtx extern void ctxStoreInit (int nbSession, int timeout, int apicount, const char *initok); -extern struct AFB_clientCtx *ctxClientGet (const char *uuid); +extern struct AFB_clientCtx *ctxClientGetForUuid (const char *uuid); +extern struct AFB_clientCtx *ctxClientGet(struct AFB_clientCtx *clientCtx); extern void ctxClientPut(struct AFB_clientCtx *clientCtx); extern void ctxClientClose (struct AFB_clientCtx *clientCtx); extern int ctxTokenCheck (struct AFB_clientCtx *clientCtx, const char *token); |