X-Git-Url: https://gerrit.automotivelinux.org/gerrit/gitweb?a=blobdiff_plain;f=src%2Fafb-session.c;h=80bad1b27e358a882acb2ab201475de0af809d73;hb=65353dce81a629e042800bb7b86fcd869a76727e;hp=8addd7ebe8787b8ed640e08e0a4debbf4ca71e58;hpb=d735ff81293a2de1860a99afef891ac3fc6c1c09;p=src%2Fapp-framework-binder.git diff --git a/src/afb-session.c b/src/afb-session.c index 8addd7eb..80bad1b2 100644 --- a/src/afb-session.c +++ b/src/afb-session.c @@ -1,5 +1,5 @@ /* - * Copyright (C) 2015-2019 "IoT.bzh" + * Copyright (C) 2015-2020 "IoT.bzh" * Author "Fulup Ar Foll" * Author: José Bollo * @@ -28,7 +28,6 @@ #include "afb-session.h" #include "afb-hook.h" -#include "afb-token.h" #include "verbose.h" #include "pearson.h" #include "uuid.h" @@ -90,7 +89,6 @@ static struct { uint16_t genid; /**< for generating ids */ int timeout; /**< common initial timeout */ struct afb_session *first; /**< sessions */ - struct afb_token *initok;/**< common initial token */ pthread_mutex_t mutex; /**< declare a mutex to protect hash table */ } sessions = { .count = 0, @@ -98,7 +96,6 @@ static struct { .genid = 1, .timeout = 3600, .first = 0, - .initok = 0, .mutex = PTHREAD_MUTEX_INITIALIZER }; @@ -326,25 +323,13 @@ static time_t sessionset_cleanup (int force) /** * Initialize the session manager with a 'max_session_count', - * an initial common 'timeout' and an initial common token 'initok'. + * an initial common 'timeout' * * @param max_session_count maximum allowed session count in the same time * @param timeout the initial default timeout of sessions - * @param initok the initial default token of sessions */ -int afb_session_init (int max_session_count, int timeout, const char *initok) +int afb_session_init (int max_session_count, int timeout) { - int rc; - uuid_stringz_t uuid; - - /* check parameters */ - if (initok && strlen(initok) >= sizeof sessions.initok) { - ERROR("initial token '%s' too long (max length %d)", - initok, ((int)(sizeof sessions.initok)) - 1); - errno = EINVAL; - return -1; - } - /* init the sessionset (after cleanup) */ sessionset_lock(); sessionset_cleanup(1); @@ -355,16 +340,6 @@ int afb_session_init (int max_session_count, int timeout, const char *initok) else sessions.max = (uint16_t)max_session_count; sessions.timeout = timeout; - if (initok == NULL) { - uuid_new_stringz(uuid); - initok = uuid; - } - sessions.initok = 0; - if (*initok) { - rc = afb_token_get(&sessions.initok, initok); - if (rc < 0) - return rc; - } sessionset_unlock(); return 0; } @@ -398,14 +373,6 @@ void afb_session_purge() sessionset_unlock(); } -/** - * @return the initial token set at initialization - */ -const char *afb_session_initial_token() -{ - return sessions.initok ? afb_token_string(sessions.initok) : ""; -} - /* Searchs the session of 'uuid' */ struct afb_session *afb_session_search (const char *uuid) {