faup1090 now exits if it loses its connection
Before this if dump1090 restarted for some reason then faup1090 will sit there indefinitely "looking" stupid and passing no data to piaware, even after dump1090 comes back up. Much gratitude to Oliver Jowett (github user mutability) for the fix.
This commit is contained in:
parent
bd690db2b3
commit
1a9811d2d5
|
|
@ -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;
|
||||
|
|
|
|||
|
|
@ -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()
|
||||
|
|
|
|||
3
net_io.c
3
net_io.c
|
|
@ -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--;
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue