Merge branch 'master' of github.com:flightaware/dump1090_mr

This commit is contained in:
Karl Lehenbauer 2014-10-02 22:14:05 -05:00
commit 438d877f98
3 changed files with 11 additions and 0 deletions

View File

@ -362,6 +362,7 @@ struct { // Internal state
unsigned int stat_fatsv_connections;
unsigned int stat_raw_connections;
unsigned int stat_beast_connections;
unsigned int stat_beast_connections_in;
unsigned int stat_out_of_phase;
unsigned int stat_ph_demodulated0;
unsigned int stat_ph_demodulated1;

View File

@ -289,6 +289,12 @@ void backgroundTasks(void) {
if (Modes.interactive) {
interactiveShowData();
}
// If we have lost our input connection, exit
if (Modes.stat_beast_connections_in == 0) {
fprintf(stderr, "Lost ADS-B data connection, exiting.\n");
Modes.exit = 1;
}
}
//
@ -394,6 +400,7 @@ int main(int argc, char **argv) {
c->service =
Modes.bis = fd;
Modes.clients = c;
Modes.stat_beast_connections_in = 1;
while (Modes.net_only) {
if (Modes.exit) exit(0); // If we exit net_only nothing further in main()

View File

@ -131,6 +131,7 @@ struct client * modesAcceptClients(void) {
if (*services[j].socket == Modes.sbsos) Modes.stat_sbs_connections++;
if (*services[j].socket == Modes.ros) Modes.stat_raw_connections++;
if (*services[j].socket == Modes.bos) Modes.stat_beast_connections++;
if (*services[j].socket == Modes.bis) Modes.stat_beast_connections_in++;
if (*services[j].socket == Modes.fatsvos) Modes.stat_fatsv_connections++;
j--; // Try again with the same listening port
@ -171,6 +172,8 @@ void modesFreeClient(struct client *c) {
if (Modes.stat_raw_connections) Modes.stat_raw_connections--;
} else if (c->service == Modes.bos) {
if (Modes.stat_beast_connections) Modes.stat_beast_connections--;
} else if (c->service == Modes.bis) {
if (Modes.stat_beast_connections_in) Modes.stat_beast_connections_in--;
} else if (c->service == Modes.fatsvos) {
if (Modes.stat_fatsv_connections) Modes.stat_fatsv_connections--;
}