diff options
author | Eric S. Raymond <esr@thyrsus.com> | 2013-11-05 15:58:17 -0500 |
---|---|---|
committer | Eric S. Raymond <esr@thyrsus.com> | 2013-11-05 15:58:17 -0500 |
commit | 5295085d224b584c6a779b08d5dedf3890401724 (patch) | |
tree | 316d034701ebc814abb47663ea49d66010213dd8 /gpsd.c | |
parent | bd0ffb3d68a514a7430973b295c4e0c2ec706184 (diff) | |
download | gpsd-5295085d224b584c6a779b08d5dedf3890401724.tar.gz |
Suppress JSON notifications to clients who haven't enabled them.
Diffstat (limited to 'gpsd.c')
-rw-r--r-- | gpsd.c | 4 |
1 files changed, 2 insertions, 2 deletions
@@ -634,7 +634,7 @@ static ssize_t throttled_write(struct subscriber_t *sub, char *buf, } static void notify_watchers(struct gps_device_t *device, const char *sentence, ...) -/* notify all clients watching a given device of an event */ +/* notify all JSON-watching clients of a given device about an event */ { va_list ap; char buf[BUFSIZ]; @@ -645,7 +645,7 @@ static void notify_watchers(struct gps_device_t *device, const char *sentence, . va_end(ap); for (sub = subscribers; sub < subscribers + MAXSUBSCRIBERS; sub++) - if (sub->active != 0 && subscribed(sub, device)) + if (sub->active != 0 && subscribed(sub, device) && sub->policy.json) (void)throttled_write(sub, buf, strlen(buf)); } #endif /* SOCKET_EXPORT_ENABLE */ |