summaryrefslogtreecommitdiff
path: root/libgpsd_core.c
diff options
context:
space:
mode:
authorEric S. Raymond <esr@thyrsus.com>2013-11-27 15:14:43 -0500
committerEric S. Raymond <esr@thyrsus.com>2013-11-27 15:14:43 -0500
commitae654f81a3bbc932d9f42b7bb6c52a84c715a4e0 (patch)
tree5e5d334cd3419cb7e95077d887a383cf8b27a5db /libgpsd_core.c
parent9b5f8efb899eb1baa64562dd0f94c3025c6c2020 (diff)
downloadgpsd-ae654f81a3bbc932d9f42b7bb6c52a84c715a4e0.tar.gz
Investigating ways to get rid of CLOSE_DELAY in the test framework...
...actually revealed a bug - device-shutdown messages getting lost on the way out to the test clients. This set of changes mostly fixes it. Some glitches remain; this state of things passes all regression tests but attempting to get rid of what now ought to be unnecessary code in fake.py does not pass. To be continued...
Diffstat (limited to 'libgpsd_core.c')
-rw-r--r--libgpsd_core.c17
1 files changed, 14 insertions, 3 deletions
diff --git a/libgpsd_core.c b/libgpsd_core.c
index 35c9a4b0..85c31ea0 100644
--- a/libgpsd_core.c
+++ b/libgpsd_core.c
@@ -1214,8 +1214,14 @@ gps_mask_t gpsd_poll(struct gps_device_t *session)
"packet sniff on %s finds type %d\n",
session->gpsdata.dev.path, session->packet.type);
if (session->packet.type == COMMENT_PACKET) {
- gpsd_report(session->context->debug, LOG_PROG,
- "comment, sync lock deferred\n");
+ if (strcmp((const char *)session->packet.outbuffer, "# EOF\n") == 0) {
+ gpsd_report(session->context->debug, LOG_PROG,
+ "synthetic EOF\n");
+ return EOF_SET;
+ }
+ else
+ gpsd_report(session->context->debug, LOG_PROG,
+ "comment, sync lock deferred\n");
/* FALL THROUGH */
} else if (session->packet.type > COMMENT_PACKET) {
if (session->device_type == NULL)
@@ -1472,7 +1478,12 @@ int gpsd_multipoll(const bool data_ready,
for (fragments = 0; ; fragments++) {
gps_mask_t changed = gpsd_poll(device);
- if (changed == ERROR_SET) {
+ if (changed == EOF_SET) {
+ gpsd_report(device->context->debug, LOG_WARN,
+ "device signed off %s\n",
+ device->gpsdata.dev.path);
+ return DEVICE_EOF;
+ } else if (changed == ERROR_SET) {
gpsd_report(device->context->debug, LOG_WARN,
"device read of %s returned error or packet sniffer failed sync (flags %s)\n",
device->gpsdata.dev.path,