X-Git-Url: https://gerrit.automotivelinux.org/gerrit/gitweb?a=blobdiff_plain;f=src%2Fafb-trace.c;h=021ab5af1bdbf57954228c50ae5c57b7a5933fc3;hb=48ecf6eed5091bdb4788da0112870e79d58baf19;hp=eb1122d4945397b8571f2cec801c6c997f9282ac;hpb=541756a5f6af26338add0b1ac7a1c0c3bb518b80;p=src%2Fapp-framework-binder.git diff --git a/src/afb-trace.c b/src/afb-trace.c index eb1122d4..021ab5af 100644 --- a/src/afb-trace.c +++ b/src/afb-trace.c @@ -1126,7 +1126,7 @@ static struct afb_session *trace_get_session_by_uuid(struct afb_trace *trace, co if (!alloc) cookie.session = afb_session_search(uuid); else { - cookie.session = afb_session_get(uuid, NULL); + cookie.session = afb_session_get(uuid, AFB_SESSION_TIMEOUT_DEFAULT, NULL); if (cookie.session) { cookie.trace = trace; afb_session_cookie(cookie.session, cookie.trace, session_open, session_closed, &cookie, 0); @@ -1211,17 +1211,19 @@ static void addhook(struct desc *desc, enum trace_type type) /* create the hook handler */ switch (type) { case Trace_Type_Xreq: - if (desc->session) { + if (!desc->session) + session = afb_session_addref(bind); + else { session = trace_get_session_by_uuid(trace, desc->session, 1); if (!session) { ctxt_error(&desc->context->errors, "allocation of session failed"); free(hook); return; } - bind = session; } - hook->handler = afb_hook_create_xreq(desc->api, desc->verb, bind, + hook->handler = afb_hook_create_xreq(desc->api, desc->verb, session, desc->flags[type], &hook_xreq_itf, hook); + afb_session_unref(session); break; case Trace_Type_Ditf: hook->handler = afb_hook_create_ditf(desc->api, desc->flags[type], &hook_ditf_itf, hook); @@ -1423,8 +1425,10 @@ static void drop_session(void *closure, struct json_object *object) session = trace_get_session_by_uuid(context->trace, uuid, 0); if (!session) ctxt_error(&context->errors, "session %s not found", uuid); - else + else { trace_unhook(context->trace, NULL, NULL, session); + afb_session_unref(session); + } } }