diff options
author | 2017-11-06 15:05:45 +0100 | |
---|---|---|
committer | 2017-11-06 15:06:55 +0100 | |
commit | 541756a5f6af26338add0b1ac7a1c0c3bb518b80 (patch) | |
tree | 56b0e931c4ba14f2541f51432d9cadc132f7eabd /src/afb-trace.c | |
parent | e106c1b5e5c4a27d6907f8f1dc55443506135072 (diff) |
afb-session: add function afb_session_search
Also the function afb_session_get always create
a session even if 'created' is NULL
Change-Id: Ia5ac1231e1d61e92cb9bbc07c968e3000d6864ff
Signed-off-by: José Bollo <jose.bollo@iot.bzh>
Diffstat (limited to 'src/afb-trace.c')
-rw-r--r-- | src/afb-trace.c | 13 |
1 files changed, 8 insertions, 5 deletions
diff --git a/src/afb-trace.c b/src/afb-trace.c index cefd2058..eb1122d4 100644 --- a/src/afb-trace.c +++ b/src/afb-trace.c @@ -1122,12 +1122,15 @@ static void *session_open(void *closure) static struct afb_session *trace_get_session_by_uuid(struct afb_trace *trace, const char *uuid, int alloc) { struct cookie cookie; - int created; - cookie.session = afb_session_get(uuid, alloc ? &created : NULL); - if (cookie.session) { - cookie.trace = trace; - afb_session_cookie(cookie.session, cookie.trace, session_open, session_closed, &cookie, 0); + if (!alloc) + cookie.session = afb_session_search(uuid); + else { + cookie.session = afb_session_get(uuid, NULL); + if (cookie.session) { + cookie.trace = trace; + afb_session_cookie(cookie.session, cookie.trace, session_open, session_closed, &cookie, 0); + } } return cookie.session; } |