summaryrefslogtreecommitdiff
path: root/gpsd.c
diff options
context:
space:
mode:
authorEric S. Raymond <esr@thyrsus.com>2013-11-05 15:58:17 -0500
committerEric S. Raymond <esr@thyrsus.com>2013-11-05 15:58:17 -0500
commit5295085d224b584c6a779b08d5dedf3890401724 (patch)
tree316d034701ebc814abb47663ea49d66010213dd8 /gpsd.c
parentbd0ffb3d68a514a7430973b295c4e0c2ec706184 (diff)
downloadgpsd-5295085d224b584c6a779b08d5dedf3890401724.tar.gz
Suppress JSON notifications to clients who haven't enabled them.
Diffstat (limited to 'gpsd.c')
-rw-r--r--gpsd.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/gpsd.c b/gpsd.c
index e787765f..35f296f0 100644
--- a/gpsd.c
+++ b/gpsd.c
@@ -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 */