X-Git-Url: https://gerrit.automotivelinux.org/gerrit/gitweb?a=blobdiff_plain;ds=sidebyside;f=src%2Fsession.c;h=11f535b3f87a9d543f91a460a234c63cd068cda0;hb=54b2652e94cfa7840dbebcba46edd5459e7c6e86;hp=e9cf298e7f10e878bca2974af624a7a9dc17ab1c;hpb=11d36a9f7e16aa9992835f8ce06f0e1e5297b131;p=src%2Fapp-framework-binder.git diff --git a/src/session.c b/src/session.c index e9cf298e..11f535b3 100644 --- a/src/session.c +++ b/src/session.c @@ -63,13 +63,13 @@ static void ctxUuidFreeCB (struct AFB_clientCtx *client) } // 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); @@ -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) {