-// Create a new store in RAM, not that is too small it will be automatically extended
-void afb_session_init (int max_session_count, int timeout, const char *initok)
-{
- // let's create as store as hashtable does not have any
- sessions.store = calloc (1 + (unsigned)max_session_count, sizeof *sessions.store);
- pthread_mutex_init(&sessions.mutex, NULL);
- sessions.max = max_session_count;
- sessions.timeout = timeout;
- if (initok == NULL)
- /* without token, a secret is made to forbid creation of sessions */
- new_uuid(sessions.initok);
- else if (strlen(initok) < sizeof(sessions.store[0]->token))
- strcpy(sessions.initok, initok);
- else {
- ERROR("initial token '%s' too long (max length 36)", initok);
- exit(1);
- }
-}
+ session = sessions.first;
+ while (session && hashidx != session->hash && strcmp(uuid, session->uuid))
+ session = session->next;