Skip to content

Commit

Permalink
[tracer] fix bogus multiple tracing
Browse files Browse the repository at this point in the history
When calling the trace() function multiple times from script (to do tracing via different backends), be sure and install all the tracing callbacks (in TM, dialog) only first time.
Reported by @gmaruzz
Closes #3082
  • Loading branch information
bogdan-iancu committed Jun 20, 2023
1 parent 63fe8ce commit 18ccdbe
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion modules/tracer/tracer.c
Original file line number Diff line number Diff line change
Expand Up @@ -1930,7 +1930,13 @@ static int sip_trace_handle(struct sip_msg *msg, tlist_elem_p el,
info->instances = instance;
}

if (trace_flags==TRACE_B2B) {
if (info->instances->next) {
/* this is not the first instance to be added, which means
* we need only to add the instance to the list (already done above).
* All the tracing callbacks are already present (set when the first
* tracing instance was created), so nothing to do from this
* perspective */
} else if (trace_flags==TRACE_B2B) {
if (trace_b2b(msg, info) < 0) {
LM_ERR("trace b2b failed!\n");
return -1;
Expand Down

0 comments on commit 18ccdbe

Please sign in to comment.