diff options
-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); |