From 15849550807ff6c08a42992b548b8f45c675d5c4 Mon Sep 17 00:00:00 2001 From: Oliver Jowett Date: Sun, 8 Feb 2015 14:37:35 +0000 Subject: [PATCH] Be more aggressive about removing aircraft where we have seen only 1 message. --- track.c | 3 ++- track.h | 3 +++ 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/track.c b/track.c index 962ebef..48dda6d 100644 --- a/track.c +++ b/track.c @@ -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) { diff --git a/track.h b/track.h index e9f627e..b7c7535 100644 --- a/track.h +++ b/track.h @@ -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