- /* clean sessions */
- psession = &trace->sessions;
- while ((session = *psession)) {
- /* search for session */
- for (hook = NULL, i = 0 ; !hook && i < Trace_Type_Count ; i++)
- for (hook = trace->hooks[i] ; hook && hook->session != session ; hook = hook->next);
- /* keep or free whether used or not */
- if (hook)
- psession = &session->next;
- else {
- *psession = session->next;
- if (__atomic_exchange_n(&session->trace, NULL, __ATOMIC_RELAXED))
- afb_session_set_cookie(session->session, session, NULL, NULL);
- free(session);
- }
- }