Skip to content

Commit

Permalink
Remote SDR Plugin: Fix one more potential crash
Browse files Browse the repository at this point in the history
  • Loading branch information
JVital2013 committed Apr 10, 2024
1 parent 587d2ff commit b1087fc
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 7 deletions.
10 changes: 9 additions & 1 deletion plugins/sdr_sources/remote_sdr_support/plugin/remote_source.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -162,7 +162,15 @@ std::vector<dsp::SourceDescriptor> RemoteSource::getAvailableSources()

service_discovery::UDPDiscoveryConfig cfg = {REMOTE_NETWORK_DISCOVERY_REQPORT, REMOTE_NETWORK_DISCOVERY_REPPORT, REMOTE_NETWORK_DISCOVERY_REQPKT, REMOTE_NETWORK_DISCOVERY_REPPKT};

auto detected_servers = service_discovery::discoverUDPServers(cfg, 100);
std::vector<std::pair<std::string, int>> detected_servers;
try
{
detected_servers = service_discovery::discoverUDPServers(cfg, 100);
}
catch(std::exception &e)
{
logger->trace("Error on Remote SDR Discovery - " + std::string(e.what()));
}
detected_servers.insert(detected_servers.end(), additional_servers.begin(), additional_servers.end());

for (auto server_ip : detected_servers)
Expand Down
7 changes: 1 addition & 6 deletions plugins/sdr_sources/remote_sdr_support/udp_discovery.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -269,12 +269,7 @@ namespace service_discovery
std::thread funrx_th(fun_rx);

std::this_thread::sleep_for(std::chrono::milliseconds(10));
try {
sendUdpBroadcast(cfg.req_port, cfg.req_pkt.data(), cfg.req_pkt.size());
}
catch (std::exception &e) {
logger->trace("Error on Remote SDR Discovery - " + std::string(e.what()));
}
sendUdpBroadcast(cfg.req_port, cfg.req_pkt.data(), cfg.req_pkt.size());

std::this_thread::sleep_for(std::chrono::milliseconds(wait_millis));
should_wait = false; // Force close with a new packet
Expand Down

0 comments on commit b1087fc

Please sign in to comment.