Version 1.09.1607.14
Improvements to COAA MLAT functions Reduce CPU load in PPUP1090 and DUMP1090 during cleanup
This commit is contained in:
parent
8b05286a24
commit
845289ad9f
BIN
coaa1090.obj
BIN
coaa1090.obj
Binary file not shown.
Binary file not shown.
|
@ -37,7 +37,7 @@
|
|||
// MinorVer changes when additional features are added, but not for bug fixes (range 00-99)
|
||||
// DayDate & Year changes for all changes, including for bug fixes. It represent the release date of the update
|
||||
//
|
||||
#define MODES_DUMP1090_VERSION "1.09.1007.14"
|
||||
#define MODES_DUMP1090_VERSION "1.09.1607.14"
|
||||
|
||||
// ============================= Include files ==========================
|
||||
|
||||
|
@ -229,6 +229,7 @@ struct aircraft {
|
|||
|
||||
struct stDF {
|
||||
struct stDF *pNext; // Pointer to next item in the linked list
|
||||
struct stDF *pPrev; // Pointer to previous item in the linked list
|
||||
struct aircraft *pAircraft; // Pointer to the Aircraft structure for this DF
|
||||
time_t seen; // Dos/UNIX Time at which the this packet was received
|
||||
uint64_t llTimestamp; // Timestamp at which the this packet was received
|
||||
|
@ -325,6 +326,7 @@ struct { // Internal state
|
|||
// Interactive mode
|
||||
struct aircraft *aircrafts;
|
||||
uint64_t interactive_last_update; // Last screen update in milliseconds
|
||||
time_t last_cleanup_time; // Last cleanup time in seconds
|
||||
|
||||
// DF List mode
|
||||
int bEnableDFLogging; // Set to enable DF Logging
|
||||
|
|
|
@ -61,8 +61,10 @@ void interactiveCreateDF(struct aircraft *a, struct modesMessage *mm) {
|
|||
memcpy(pDF->msg, mm->msg, MODES_LONG_MSG_BYTES);
|
||||
|
||||
if (!pthread_mutex_lock(&Modes.pDF_mutex)) {
|
||||
pDF->pNext = Modes.pDF;
|
||||
Modes.pDF = pDF;
|
||||
if ((pDF->pNext = Modes.pDF)) {
|
||||
Modes.pDF->pPrev = pDF;
|
||||
}
|
||||
Modes.pDF = pDF;
|
||||
pthread_mutex_unlock(&Modes.pDF_mutex);
|
||||
} else {
|
||||
free(pDF);
|
||||
|
@ -83,7 +85,7 @@ void interactiveRemoveStaleDF(time_t now) {
|
|||
pDF = Modes.pDF;
|
||||
while(pDF) {
|
||||
if ((now - pDF->seen) > Modes.interactive_delete_ttl) {
|
||||
if (!prev) {
|
||||
if (Modes.pDF == pDF) {
|
||||
Modes.pDF = NULL;
|
||||
} else {
|
||||
prev->pNext = NULL;
|
||||
|
@ -91,14 +93,13 @@ void interactiveRemoveStaleDF(time_t now) {
|
|||
|
||||
// All DF's in the list from here onwards will be time
|
||||
// expired, so delete them all
|
||||
while ((prev = pDF)) {
|
||||
pDF = pDF->pNext;
|
||||
while (pDF) {
|
||||
prev = pDF; pDF = pDF->pNext;
|
||||
free(prev);
|
||||
}
|
||||
|
||||
} else {
|
||||
prev = pDF;
|
||||
pDF = pDF->pNext;
|
||||
prev = pDF; pDF = pDF->pNext;
|
||||
}
|
||||
}
|
||||
pthread_mutex_unlock (&Modes.pDF_mutex);
|
||||
|
@ -533,25 +534,24 @@ void interactiveRemoveStaleAircrafts(void) {
|
|||
struct aircraft *prev = NULL;
|
||||
time_t now = time(NULL);
|
||||
|
||||
interactiveRemoveStaleDF(now);
|
||||
// Only do cleanup once per second
|
||||
if (Modes.last_cleanup_time != now) {
|
||||
Modes.last_cleanup_time = now;
|
||||
|
||||
while(a) {
|
||||
if ((now - a->seen) > Modes.interactive_delete_ttl) {
|
||||
struct aircraft *next = a->next;
|
||||
// Remove the element from the linked list, with care
|
||||
// if we are removing the first element
|
||||
interactiveRemoveStaleDF(now);
|
||||
|
||||
if (!prev) {
|
||||
Modes.aircrafts = next;
|
||||
while(a) {
|
||||
if ((now - a->seen) > Modes.interactive_delete_ttl) {
|
||||
// Remove the element from the linked list, with care
|
||||
// if we are removing the first element
|
||||
if (!prev) {
|
||||
Modes.aircrafts = a->next; free(a); a = Modes.aircrafts;
|
||||
} else {
|
||||
prev->next = a->next; free(a); a = prev->next;
|
||||
}
|
||||
} else {
|
||||
prev->next = next;
|
||||
prev = a; a = a->next;
|
||||
}
|
||||
|
||||
free(a);
|
||||
a = next;
|
||||
} else {
|
||||
prev = a;
|
||||
a = a->next;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
1
mode_s.c
1
mode_s.c
|
@ -2044,7 +2044,6 @@ void decodeCPR(struct aircraft *a, int fflag, int surface) {
|
|||
surface_rlat = Modes.fUserLat;
|
||||
surface_rlon = Modes.fUserLon;
|
||||
} else {
|
||||
surface_rlat = Modes.fUserLat;
|
||||
return;
|
||||
}
|
||||
rlat0 += floor(surface_rlat / 90.0) * 90.0; // Move from 1st quadrant to our quadrant
|
||||
|
|
14
ppup1090.c
14
ppup1090.c
|
@ -208,7 +208,7 @@ int main(int argc, char **argv) {
|
|||
|
||||
#ifdef _WIN32
|
||||
// Try to comply with the Copyright license conditions for binary distribution
|
||||
if (!Modes.quiet) {showCopyright();}
|
||||
if (!ppup1090.quiet) {showCopyright();}
|
||||
#endif
|
||||
|
||||
// Initialization
|
||||
|
@ -222,18 +222,18 @@ int main(int argc, char **argv) {
|
|||
//
|
||||
// Setup a service callback client structure for a beast binary input (from dump1090)
|
||||
// This is a bit dodgy under Windows. The fd parameter is a handle to the internet
|
||||
// socket on which we are receiving data. Under Linux, these seem to start at 0 and
|
||||
// socket on which we are receiving data. Under Linux, these seem to start at 0 and
|
||||
// count upwards. However, Windows uses "HANDLES" and these don't nececeriy start at 0.
|
||||
// dump1090 limits fd to values less than 1024, and then uses the fd parameter to
|
||||
// dump1090 limits fd to values less than 1024, and then uses the fd parameter to
|
||||
// index into an array of clients. This is ok-ish if handles are allocated up from 0.
|
||||
// However, there is no gaurantee that Windows will behave like this, and if Windows
|
||||
// allocates a handle greater than 1024, then dump1090 won't like it. On my test machine,
|
||||
// However, there is no gaurantee that Windows will behave like this, and if Windows
|
||||
// allocates a handle greater than 1024, then dump1090 won't like it. On my test machine,
|
||||
// the first Windows handle is usually in the 0x54 (84 decimal) region.
|
||||
|
||||
c = (struct client *) malloc(sizeof(*c));
|
||||
c->next = NULL;
|
||||
c->buflen = 0;
|
||||
c->fd =
|
||||
c->fd =
|
||||
c->service =
|
||||
Modes.bis = fd;
|
||||
Modes.clients = c;
|
||||
|
@ -246,7 +246,7 @@ int main(int argc, char **argv) {
|
|||
}
|
||||
|
||||
// The user has stopped us, so close any socket we opened
|
||||
if (fd != ANET_ERR)
|
||||
if (fd != ANET_ERR)
|
||||
{close(fd);}
|
||||
|
||||
closeCOAA ();
|
||||
|
|
Loading…
Reference in a new issue