aboutsummaryrefslogtreecommitdiffstats
path: root/src/afb-export.c
diff options
context:
space:
mode:
authorJosé Bollo <jose.bollo@iot.bzh>2019-07-16 14:12:35 +0200
committerJose Bollo <jose.bollo@iot.bzh>2019-07-18 15:38:02 +0200
commit5b5968815dc672467f40ed6b49f05a590bdb8b4d (patch)
treea850a00955f697eb2766027e8f60731af344a2cc /src/afb-export.c
parent6fe59e27c0640462f92133106b4d4d52d77683f9 (diff)
afb-evt: Refactor processing of broadcasted events
Solving the bug SPEC-2625 needs to rework the broadcasting of events. It appeared that the numerical event identifier passed for broadcast wasn't used by called function except for hooking. Suppressing it introduces a clear distinction between the push and the broadcast paths. The file afb-ws-json1 is changed to avoid casting of functions. Bug-AGL: SPEC-2625 Change-Id: I9fe75adc8086812b21b70ce28baffcf77bd5e1cf Signed-off-by: José Bollo <jose.bollo@iot.bzh>
Diffstat (limited to 'src/afb-export.c')
-rw-r--r--src/afb-export.c14
1 files changed, 12 insertions, 2 deletions
diff --git a/src/afb-export.c b/src/afb-export.c
index 8de9f3be..4fbb1318 100644
--- a/src/afb-export.c
+++ b/src/afb-export.c
@@ -1250,10 +1250,20 @@ static void listener_of_events(void *closure, const char *event, int eventid, st
json_object_put(object);
}
+static void listener_of_pushed_events(void *closure, const char *event, int eventid, struct json_object *object)
+{
+ listener_of_events(closure, event, eventid, object);
+}
+
+static void listener_of_broadcasted_events(void *closure, const char *event, struct json_object *object)
+{
+ listener_of_events(closure, event, 0, object);
+}
+
/* the interface for events */
static const struct afb_evt_itf evt_itf = {
- .broadcast = listener_of_events,
- .push = listener_of_events
+ .broadcast = listener_of_broadcasted_events,
+ .push = listener_of_pushed_events
};
/* ensure an existing listener */