diff --git a/net_io.c b/net_io.c index 0c643451..451d52cc 100644 --- a/net_io.c +++ b/net_io.c @@ -1045,11 +1045,6 @@ void modesInitNet(void) { } serviceListen(Modes.beast_in_service, Modes.net_bind_address, Modes.net_input_beast_ports, Modes.net_epfd); - /* Beast input from local Modes-S Beast via USB */ - if (Modes.sdr_type == SDR_MODESBEAST || Modes.sdr_type == SDR_GNS) { - Modes.serial_client = createSocketClient(Modes.beast_in_service, Modes.beast_fd); - } - /* Planefinder input via network */ planefinder_in = serviceInit(&Modes.services_in, "Planefinder TCP input", NULL, no_heartbeat, no_heartbeat, READ_MODE_PLANEFINDER, NULL, decodePfMessage); serviceListen(planefinder_in, Modes.net_bind_address, Modes.net_input_planefinder_ports, Modes.net_epfd); @@ -5466,7 +5461,11 @@ void modesNetPeriodicWork(void) { timespec_add_elapsed(&before, &after, &Modes.stats_current.background_cpu); } - if (Modes.serial_client) { + /* Beast input from local Modes-S Beast via USB */ + if (Modes.sdrInitialized && (Modes.sdr_type == SDR_MODESBEAST || Modes.sdr_type == SDR_GNS)) { + if (!Modes.serial_client) { + Modes.serial_client = createSocketClient(Modes.beast_in_service, Modes.beast_fd); + } if (Modes.serial_client->service) { modesReadFromClient(Modes.serial_client, mb); } else {