From fb110802d65371ae2f492270c1a14cbfc3c95999 Mon Sep 17 00:00:00 2001 From: Oliver Jowett Date: Mon, 2 Dec 2019 19:50:31 +0800 Subject: [PATCH] When view1090 reconnects, re-send our connection settings on the new connection --- view1090.c | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) diff --git a/view1090.c b/view1090.c index f1522a9..e5b8fa0 100644 --- a/view1090.c +++ b/view1090.c @@ -130,6 +130,13 @@ void showHelp(void) { ); } +void sendSettings(struct client *c) +{ + sendBeastSettings(c, "CdV"); // Beast binary format, no filters, verbatim mode on + sendBeastSettings(c, Modes.mode_ac ? "J" : "j"); // Mode A/C on or off + sendBeastSettings(c, Modes.check_crc ? "f" : "F"); // CRC checks on or off +} + // //========================================================================= // @@ -206,10 +213,7 @@ int main(int argc, char **argv) { fprintf(stderr, "Failed to connect to %s:%d: %s\n", bo_connect_ipaddr, bo_connect_port, Modes.aneterr); exit(1); } - - sendBeastSettings(c, "CdV"); // Beast binary format, no filters, verbatim mode on - sendBeastSettings(c, Modes.mode_ac ? "J" : "j"); // Mode A/C on or off - sendBeastSettings(c, Modes.check_crc ? "f" : "F"); // CRC checks on or off + sendSettings(c); // Keep going till the user does something that stops us while (!Modes.exit) { @@ -225,6 +229,9 @@ int main(int argc, char **argv) { // lost input connection, try to reconnect sleep(1); c = serviceConnect(s, bo_connect_ipaddr, bo_connect_port); + if (c) { + sendSettings(c); + } continue; }