summaryrefslogtreecommitdiffstats
path: root/binding
diff options
context:
space:
mode:
authorJan-Simon Moeller <jsmoeller@linuxfoundation.org>2019-03-07 01:12:02 +0000
committerGerrit Code Review <gerrit@automotivelinux.org>2019-03-07 01:12:02 +0000
commit0b5c45988619aaf247b41b03ed8157213f1de9a8 (patch)
tree3bed7f8b78f303e337eb07af49e13d61148f50cd /binding
parentf8188142976967552c5af53be8eaca444c096f02 (diff)
parent3240e15a7eee0cad6786410bdfc5b345ec46c9af (diff)
Merge "Increase timeout on gpsd response"
Diffstat (limited to 'binding')
-rw-r--r--binding/afm-gps-binding.c9
1 files changed, 7 insertions, 2 deletions
diff --git a/binding/afm-gps-binding.c b/binding/afm-gps-binding.c
index d09765a..873c264 100644
--- a/binding/afm-gps-binding.c
+++ b/binding/afm-gps-binding.c
@@ -265,13 +265,18 @@ static void add_record(json_object *jresp)
static void *data_poll(void *ptr)
{
+ int tries = 0;
+
/*
* keep reading till an error condition happens
*/
- while (gps_waiting(&data, MSECS_TO_USECS(2000)) && !errno)
- {
+ while (tries < 60) {
json_object *jresp = NULL;
+ if (gps_waiting(&data, MSECS_TO_USECS(2000)) < 0) {
+ tries++;
+ continue;
+ }
pthread_mutex_lock(&mutex);
if (gps_read(&data) == -1) {
AFB_ERROR("Cannot read from GPS daemon.\n");