From 6dfeafe7e4fa582b3db3f950136bc97f8611fc6d Mon Sep 17 00:00:00 2001 From: José Bollo Date: Tue, 16 Jul 2019 23:39:27 +0200 Subject: Tag broadcasted events with UUID and hop MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit When API have mutual dependencies, leading to loops in dependecies, broadcasting an event never ends because of the loop (see SPEC-2625). To avoid that weird flood of events, a unic identifier (UUID) is attached to broadcasted event and a tiny memory records previously broadcasted events to avoid re-sending an already sent event. The size of the memory can be set using the macro variable EVENT_BROADCAST_MEMORY_COUNT whose default value is 8. It can be reduced to 0. An other mecanism is added to limit the count of hops that a broadcasted event can do. That count can be set using the macro variable EVENT_BROADCAST_HOP_MAX whose default value is 10. Bug-AGL: SPEC-2625 Change-Id: I29550a8a5c8f5e2ffb20edc3330357a1e870c0e2 Signed-off-by: José Bollo --- bindings/samples/hello3.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'bindings/samples') diff --git a/bindings/samples/hello3.c b/bindings/samples/hello3.c index ff7da61a..efd338c9 100644 --- a/bindings/samples/hello3.c +++ b/bindings/samples/hello3.c @@ -424,7 +424,7 @@ static void broadcast(afb_req_t request) afb_req_success(request, NULL, NULL); pthread_mutex_unlock(&mutex); } else if (name != NULL) { - if (0 > afb_daemon_broadcast_event(name, object)) + if (0 > afb_daemon_broadcast_event(name, json_object_get(object))) afb_req_fail(request, "failed", "broadcast error"); else afb_req_success(request, NULL, NULL); -- cgit