Skip to content

Commit

Permalink
fix:vehicle:gpsd:Retry connect after 10 seconds not performed (#1099)
Browse files Browse the repository at this point in the history
* FIX: Retry connect after 10 seconds not performed

Set priv->cbt before starting the timer.

* Set priv->cbt in vehicle_gpsd_try_open to be able to reconnect any time not just at startup

* Don't release the gps object
  • Loading branch information
OLFDB committed Mar 10, 2021
1 parent 4dca2cb commit 2f42f57
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions navit/vehicle/gpsd/vehicle_gpsd.c
Original file line number Diff line number Diff line change
Expand Up @@ -236,6 +236,7 @@ static int vehicle_gpsd_try_open(struct vehicle_priv *priv) {
priv->gps = gps_open(source + 7, port);
if(!priv->gps) {
#endif
priv->cbt = callback_new_1(callback_cast(vehicle_gpsd_try_open), priv);
dbg(lvl_error,"gps_open failed for '%s'. Retrying in %d seconds. Have you started gpsd?", priv->source,
priv->retry_interval);
g_free(source);
Expand Down Expand Up @@ -312,10 +313,11 @@ static void vehicle_gpsd_close(struct vehicle_priv *priv) {
}
if (priv->gps) {
gps_close(priv->gps);
#if GPSD_API_MAJOR_VERSION >= 5
g_free(priv->gps);
#endif
priv->gps = NULL;
//if we release the gps object a reconnect is no longer working.
//#if GPSD_API_MAJOR_VERSION >= 5
// g_free(priv->gps);
//#endif
// priv->gps = NULL;
}
#ifdef HAVE_GPSBT
err = gpsbt_stop(&priv->context);
Expand Down

0 comments on commit 2f42f57

Please sign in to comment.