Opened 15 years ago
Closed 14 years ago
#68 closed defect/bug (fixed)
Navit goes into tight loop if gpsd socket is closed
Reported by: | mattcallow | Owned by: | KaZeR |
---|---|---|---|
Priority: | minor | Milestone: | version 0.1.0 |
Component: | core | Version: | git master |
Severity: | Keywords: | ||
Cc: |
Description
when using gpsd (for example with gpsfake, but possibly with a real gps as well), if gpsd is stopped (and the socket closed) Navit does into an endless loop. This is beacuse it does not detect that the socket has closed.
Possible patch:
Index: vehicle/gpsd/vehicle_gpsd.c =================================================================== RCS file: /cvsroot/navit/navit/src/vehicle/gpsd/vehicle_gpsd.c,v retrieving revision 1.4 diff -u -r1.4 vehicle_gpsd.c --- vehicle/gpsd/vehicle_gpsd.c 10 Jan 2008 17:56:33 -0000 1.4 +++ vehicle/gpsd/vehicle_gpsd.c 11 Jan 2008 04:26:19 -0000 @@ -85,8 +85,10 @@ } else priv->gps = gps_open(source + 7, NULL); g_free(source); - if (!priv->gps) + if (!priv->gps) { + dbg(0, "gps_open failed\n"); return 0; + } gps_query(priv->gps, "w+x\n"); gps_set_raw_hook(priv->gps, vehicle_gpsd_callback); priv->iochan = g_io_channel_unix_new(priv->gps->gps_fd); @@ -124,7 +126,12 @@ if (condition == G_IO_IN) { if (priv->gps) { vehicle_last = priv; - gps_poll(priv->gps); + if (gps_poll(priv->gps)) { + dbg(0, "gps_poll failed\n"); + vehicle_gpsd_close(priv); + vehicle_gpsd_open(priv); + } + } return TRUE; }
Would a retry mechanism be appropriate if gps_open fails ?
Change History (4)
comment:1 Changed 15 years ago by KaZeR
- Milestone set to version 0.0.4
- Owner changed from somebody to KaZeR
- Status changed from new to assigned
comment:2 Changed 15 years ago by KaZeR
comment:3 Changed 15 years ago by mattcallow
Retry has been added to cvs.
comment:4 Changed 14 years ago by KaZeR
- Resolution set to fixed
- Status changed from assigned to closed
Note: See
TracTickets for help on using
tickets.
Patch has been applied. Thank you. A retry mechanism would be useful yes, so that if gpsd is started too late, navit can retry the connection. I let the ticket open for now until it is implemented.