ucentral-event: fix polled telemetry stream

Fixes: WIFI-12341
Signed-off-by: John Crispin <john@phrozen.org>
This commit is contained in:
John Crispin
2023-02-20 10:35:53 +01:00
parent 9221c3e7e7
commit c55d19c3c5

View File

@@ -43,7 +43,14 @@ function event(object, verb, payload) {
let type = object;
if (verb)
type += '.' + verb;
if (match(object, type, config.bulk?.filter))
if (match(object, type, config.realtime?.filter))
ubus.call('ucentral', 'event', {
type,
payload
});
else if (!config.bulk?.interval || match(object, type, config.bulk?.filter))
ubus.call('ucentral', 'telemetry', {
event: 'event',
payload: {
@@ -51,11 +58,6 @@ function event(object, verb, payload) {
payload
}
});
else if (match(object, type, config.realtime?.filter))
ubus.call('ucentral', 'event', {
type,
payload
});
}
let handlers = {
@@ -114,7 +116,7 @@ let handlers = {
function hapd_subscriber_notify_cb(notify) {
if (config.wifi?.filter == '*' || index(config.wifi?.filter || [], notify.type) > 0) {
if (config.wifi?.filter == '*' || index(config.wifi?.filter || [], notify.type) >= 0) {
let payload = {};
payload[notify.type] = notify.data;
ubus.call('ucentral', 'telemetry', {
@@ -181,7 +183,7 @@ function hapd_subscriber_remove_cb(remove) {
}
function dhcp_subscriber_notify_cb(notify) {
if (config.dhcp?.filter == '*' || index(config.dhcp?.filter || [], notify.type) > 0) {
if (config.dhcp?.filter == '*' || index(config.dhcp?.filter || [], notify.type) >= 0) {
notify.data.type = notify.type;
ubus.call('ucentral', 'telemetry', {
event: 'dhcp-snooping',