X-Git-Url: https://gerrit.automotivelinux.org/gerrit/gitweb?a=blobdiff_plain;f=src%2Fsession.c;h=16dc836903021bef8cfd9f36bf9ebf496d4ebd84;hb=bf9d05d3ba3c482a75cfa6aedf661f6e51728e3e;hp=320eab9b8e2fde3b9ce08fd04bfed3eab4c6ab07;hpb=c7e9786d408f13d8f8f43c6b68da916bbb1ed5f3;p=src%2Fapp-framework-binder.git diff --git a/src/session.c b/src/session.c index 320eab9b..16dc8369 100644 --- a/src/session.c +++ b/src/session.c @@ -48,6 +48,7 @@ struct afb_event_listener_list struct AFB_clientCtx { unsigned refcount; + unsigned loa; time_t expiration; // expiration time of the token time_t access; char uuid[37]; // long term authentication of remote client @@ -434,6 +435,18 @@ const char *ctxClientGetToken (struct AFB_clientCtx *clientCtx) return clientCtx->token; } +unsigned ctxClientGetLOA (struct AFB_clientCtx *clientCtx) +{ + assert(clientCtx != NULL); + return clientCtx->loa; +} + +void ctxClientSetLOA (struct AFB_clientCtx *clientCtx, unsigned loa) +{ + assert(clientCtx != NULL); + clientCtx->loa = loa; +} + void *ctxClientValueGet(struct AFB_clientCtx *clientCtx, int index) { assert(clientCtx != NULL); @@ -450,6 +463,6 @@ void ctxClientValueSet(struct AFB_clientCtx *clientCtx, int index, void *value, assert(index < sessions.apicount); prev = clientCtx->values[index]; clientCtx->values[index] = (struct client_value){.value = value, .free_value = free_value}; - if (prev.value != NULL && prev.free_value != NULL) + if (prev.value != NULL && prev.value != value && prev.free_value != NULL) prev.free_value(prev.value); }