Change-Id: Id9113a4e14da296d929fed0fd2f1dd7cfeba839b
Signed-off-by: José Bollo <jose.bollo@iot.bzh>
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;
}
#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"
}
// 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;
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) {
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);