session: Use session->thread_index to correctly retrieve the session

No match.