}
// Create a new store in RAM, not that is too small it will be automatically extended
-void ctxStoreInit (int nbSession, int timeout, int apicount, const char *initok)
+void ctxStoreInit (int nbSession, int timeout, const char *initok)
{
// let's create as store as hashtable does not have any
sessions.store = calloc (1 + (unsigned)nbSession, sizeof(struct AFB_clientCtx));
sessions.max = nbSession;
sessions.timeout = timeout;
- sessions.apicount = apicount;
+ sessions.apicount = afb_apis_count();
if (strlen(initok) >= 37) {
fprintf(stderr, "Error: initial token '%s' too long (max length 36)", initok);
exit(1);
}
// 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) {