Skip to content
This repository has been archived by the owner on Sep 14, 2019. It is now read-only.

Commit

Permalink
Remove dead tracking code related to the removed PlanePlotter feed.
Browse files Browse the repository at this point in the history
  • Loading branch information
mutability committed Jan 4, 2015
1 parent 76474f5 commit 43ec58c
Show file tree
Hide file tree
Showing 5 changed files with 1 addition and 105 deletions.
1 change: 1 addition & 0 deletions debian/changelog
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
dump1090-mutability (1.10.3010.14mu-9) UNRELEASED; urgency=medium

* Fix warnings. Add -Werror so they break the build in future.
* Remove dead tracking code related to the removed PlanePlotter feed.

-- Oliver Jowett <[email protected]> Sun, 04 Jan 2015 20:08:01 +0000

Expand Down
1 change: 0 additions & 1 deletion dump1090.c
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,6 @@ void modesInitConfig(void) {
void modesInit(void) {
int i, q;

pthread_mutex_init(&Modes.pDF_mutex,NULL);
pthread_mutex_init(&Modes.data_mutex,NULL);
pthread_cond_init(&Modes.data_cond,NULL);

Expand Down
16 changes: 0 additions & 16 deletions dump1090.h
Original file line number Diff line number Diff line change
Expand Up @@ -250,16 +250,6 @@ struct aircraft {
struct aircraft *next; // Next aircraft in our linked list
};

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
uint32_t addr; // Timestamp at which the this packet was received
unsigned char msg[MODES_LONG_MSG_BYTES]; // the binary
} tDF;

// Common stats for non-phase-corrected vs phase-corrected cases
struct demod_stats {
unsigned int demodulated0;
Expand Down Expand Up @@ -383,11 +373,6 @@ struct { // Internal state
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
pthread_mutex_t pDF_mutex; // Mutex to synchronize pDF access
struct stDF *pDF; // Pointer to DF list

// Statistics
unsigned int stat_preamble_no_correlation;
unsigned int stat_preamble_not_quiet;
Expand Down Expand Up @@ -487,7 +472,6 @@ void interactiveShowData(void);
void interactiveRemoveStaleAircrafts(void);
int decodeBinMessage (struct client *c, char *p);
struct aircraft *interactiveFindAircraft(uint32_t addr);
struct stDF *interactiveFindDF (uint32_t addr);

//
// Functions exported from net_io.c
Expand Down
87 changes: 0 additions & 87 deletions interactive.c
Original file line number Diff line number Diff line change
Expand Up @@ -41,87 +41,7 @@ static uint64_t mstime(void) {
mst += tv.tv_usec/1000;
return mst;
}
//
//=========================================================================
//
// Add a new DF structure to the interactive mode linked list
//
void interactiveCreateDF(struct aircraft *a, struct modesMessage *mm) {
struct stDF *pDF = (struct stDF *) malloc(sizeof(*pDF));

if (pDF) {
// Default everything to zero/NULL
memset(pDF, 0, sizeof(*pDF));

// Now initialise things
pDF->seen = a->seen;
pDF->llTimestamp = mm->timestampMsg;
pDF->addr = mm->addr;
pDF->pAircraft = a;
memcpy(pDF->msg, mm->msg, MODES_LONG_MSG_BYTES);

if (!pthread_mutex_lock(&Modes.pDF_mutex)) {
if ((pDF->pNext = Modes.pDF)) {
Modes.pDF->pPrev = pDF;
}
Modes.pDF = pDF;
pthread_mutex_unlock(&Modes.pDF_mutex);
} else {
free(pDF);
}
}
}
//
// Remove stale DF's from the interactive mode linked list
//
void interactiveRemoveStaleDF(time_t now) {
struct stDF *pDF = NULL;
struct stDF *prev = NULL;

// Only fiddle with the DF list if we gain possession of the mutex
// If we fail to get the mutex we'll get another chance to tidy the
// DF list in a second or so.
if (!pthread_mutex_trylock(&Modes.pDF_mutex)) {
pDF = Modes.pDF;
while(pDF) {
if ((now - pDF->seen) > Modes.interactive_delete_ttl) {
if (Modes.pDF == pDF) {
Modes.pDF = NULL;
} else {
prev->pNext = NULL;
}

// All DF's in the list from here onwards will be time
// expired, so delete them all
while (pDF) {
prev = pDF; pDF = pDF->pNext;
free(prev);
}

} else {
prev = pDF; pDF = pDF->pNext;
}
}
pthread_mutex_unlock (&Modes.pDF_mutex);
}
}

struct stDF *interactiveFindDF(uint32_t addr) {
struct stDF *pDF = NULL;

if (!pthread_mutex_lock(&Modes.pDF_mutex)) {
pDF = Modes.pDF;
while(pDF) {
if (pDF->addr == addr) {
pthread_mutex_unlock (&Modes.pDF_mutex);
return (pDF);
}
pDF = pDF->pNext;
}
pthread_mutex_unlock (&Modes.pDF_mutex);
}
return (NULL);
}
//
//========================= Interactive mode ===============================
//
Expand Down Expand Up @@ -396,11 +316,6 @@ struct aircraft *interactiveReceiveData(struct modesMessage *mm) {
}
}

// If we are Logging DF's, and it's not a Mode A/C
if ((Modes.bEnableDFLogging) && (mm->msgtype < 32)) {
interactiveCreateDF(a,mm);
}

return (a);
}
//
Expand Down Expand Up @@ -539,8 +454,6 @@ void interactiveRemoveStaleAircrafts(void) {
if (Modes.last_cleanup_time != now) {
Modes.last_cleanup_time = now;

interactiveRemoveStaleDF(now);

while(a) {
if ((now - a->seen) > Modes.interactive_delete_ttl) {
// Remove the element from the linked list, with care
Expand Down
1 change: 0 additions & 1 deletion view1090.c
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,6 @@ void view1090InitConfig(void) {
//
void view1090Init(void) {

pthread_mutex_init(&Modes.pDF_mutex,NULL);
pthread_mutex_init(&Modes.data_mutex,NULL);
pthread_cond_init(&Modes.data_cond,NULL);

Expand Down

0 comments on commit 43ec58c

Please sign in to comment.