From 03ba828f8d79badc6c0582352b48069cea1e50a3 Mon Sep 17 00:00:00 2001 From: Oliver Jowett Date: Sun, 7 Jun 2015 12:07:08 +0100 Subject: [PATCH] Rearrange position cleanup to be a bit more obvious. Previously it forgot to advance to the next aircraft and only happened to work because it cleared the position bitflags and so the next iteration (on the same aircraft) would advance. --- track.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/track.c b/track.c index b858609..8907f2c 100644 --- a/track.c +++ b/track.c @@ -636,10 +636,11 @@ static void trackRemoveStaleAircraft(uint64_t now) } else { prev->next = a->next; free(a); a = prev->next; } - } else if ((a->bFlags & MODES_ACFLAGS_LATLON_VALID) && (now - a->seenLatLon) > TRACK_AIRCRAFT_POSITION_TTL) { - /* Position is too old and no longer valid */ - a->bFlags &= ~(MODES_ACFLAGS_LATLON_VALID | MODES_ACFLAGS_LATLON_REL_OK); } else { + if ((a->bFlags & MODES_ACFLAGS_LATLON_VALID) && (now - a->seenLatLon) > TRACK_AIRCRAFT_POSITION_TTL) { + /* Position is too old and no longer valid */ + a->bFlags &= ~(MODES_ACFLAGS_LATLON_VALID | MODES_ACFLAGS_LATLON_REL_OK); + } prev = a; a = a->next; } }