Be more aggressive about removing aircraft where we have seen only 1 message.

This commit is contained in:
Oliver Jowett 2015-02-08 14:37:35 +00:00
parent 20407e5378
commit 1584955080
2 changed files with 5 additions and 1 deletions

View file

@ -484,7 +484,8 @@ static void trackRemoveStaleAircraft(time_t now)
struct aircraft *prev = NULL;
while(a) {
if ((now - a->seen) > TRACK_AIRCRAFT_TTL) {
if ((now - a->seen) > TRACK_AIRCRAFT_TTL ||
(a->messages == 1 && (now - a->seen) > TRACK_AIRCRAFT_ONEHIT_TTL)) {
// Remove the element from the linked list, with care
// if we are removing the first element
if (!prev) {

View file

@ -53,6 +53,9 @@
/* Maximum age of tracked aircraft in seconds */
#define TRACK_AIRCRAFT_TTL 300
/* Maximum age of a tracked aircraft with only 1 message received, in seconds */
#define TRACK_AIRCRAFT_ONEHIT_TTL 30
/* Structure used to describe the state of one tracked aircraft */
struct aircraft {
uint32_t addr; // ICAO address