Skip to content

Commit

Permalink
event: fix test_call_answer_hangup_b
Browse files Browse the repository at this point in the history
  • Loading branch information
cspiel1 committed May 3, 2024
1 parent e384139 commit d8cd089
Showing 1 changed file with 14 additions and 11 deletions.
25 changes: 14 additions & 11 deletions src/event.c
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ struct ehe {
static struct list ehel; /**< Event handlers (struct ehe) */


static int bevent_emit_base(struct bevent *event);
static bool bevent_emit_base(struct bevent *event);


static void ehe_destructor(void *arg)
Expand Down Expand Up @@ -663,7 +663,7 @@ void module_event(const char *module, const char *event, struct ua *ua,
}


static int bevent_emit_base(struct bevent *event)
static bool bevent_emit_base(struct bevent *event)
{
struct le *le;
le = ehel.head;
Expand All @@ -672,19 +672,18 @@ static int bevent_emit_base(struct bevent *event)
le = le->next;

if (ehe->h(event, ehe->arg))
break;
return true;
}

if (event->err)
return event->err;

return 0;
return false;
}


static int bevent_emit(struct bevent *event, const char *fmt, va_list ap)
{
char *buf;
struct call *call = bevent_get_call(event);
struct ua *ua = bevent_get_ua(event);
int err;

if (!fmt)
Expand All @@ -696,13 +695,17 @@ static int bevent_emit(struct bevent *event, const char *fmt, va_list ap)

event->txt = buf;
event->err = 0;
err = bevent_emit_base(event);
if (err)
bool stop = bevent_emit_base(event);
if (event->err) {
err = event->err;
goto out;
}

/* backwards compatibility */
ua_event_private(bevent_get_ua(event), event->ev,
bevent_get_call(event), event->txt);
if (stop)
goto out;

ua_event_private(ua, event->ev, call, event->txt);

out:
mem_deref(buf);
Expand Down

0 comments on commit d8cd089

Please sign in to comment.