Be more aggressive about removing aircraft where we have seen only 1 message.
This commit is contained in:
parent
20407e5378
commit
1584955080
3
track.c
3
track.c
|
@ -484,7 +484,8 @@ static void trackRemoveStaleAircraft(time_t now)
|
||||||
struct aircraft *prev = NULL;
|
struct aircraft *prev = NULL;
|
||||||
|
|
||||||
while(a) {
|
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
|
// Remove the element from the linked list, with care
|
||||||
// if we are removing the first element
|
// if we are removing the first element
|
||||||
if (!prev) {
|
if (!prev) {
|
||||||
|
|
3
track.h
3
track.h
|
@ -53,6 +53,9 @@
|
||||||
/* Maximum age of tracked aircraft in seconds */
|
/* Maximum age of tracked aircraft in seconds */
|
||||||
#define TRACK_AIRCRAFT_TTL 300
|
#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 */
|
/* Structure used to describe the state of one tracked aircraft */
|
||||||
struct aircraft {
|
struct aircraft {
|
||||||
uint32_t addr; // ICAO address
|
uint32_t addr; // ICAO address
|
||||||
|
|
Loading…
Reference in a new issue