add fobossdr_source module and fix network sink crash when the given hostname is invalid

This commit is contained in:
AlexandreRouma
2024-09-11 21:57:12 +02:00
parent 79dd5bdcbb
commit c2f0e756a5
6 changed files with 419 additions and 10 deletions

View File

@ -217,14 +217,19 @@ private:
}
void startServer() {
if (modeId == SINK_MODE_TCP) {
listener = net::listen(hostname, port);
if (listener) {
listener->acceptAsync(clientHandler, this);
try {
if (modeId == SINK_MODE_TCP) {
listener = net::listen(hostname, port);
if (listener) {
listener->acceptAsync(clientHandler, this);
}
}
else {
conn = net::openUDP("0.0.0.0", port, hostname, port, false);
}
}
else {
conn = net::openUDP("0.0.0.0", port, hostname, port, false);
catch (const std::exception& e) {
flog::error("Failed to open socket: {}", e.what());
}
}