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.
This commit is contained in:
Oliver Jowett 2015-06-07 12:07:08 +01:00
parent a60270e20e
commit 03ba828f8d

View file

@ -636,10 +636,11 @@ static void trackRemoveStaleAircraft(uint64_t now)
} else { } else {
prev->next = a->next; free(a); a = prev->next; 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 { } 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; prev = a; a = a->next;
} }
} }