Fix monitor spamming errors when dest UDP port is unreachable

Use socket.send_to instead of socket.send

Signed-off-by: Vladislav P <vladisslav2011@gmail.com>
This commit is contained in:
Vladislav P 2022-10-05 21:38:13 +03:00
parent 4f2d73dfe3
commit 652c03430f
No known key found for this signature in database
GPG Key ID: 631C5FD38EE8D868
3 changed files with 4 additions and 8 deletions

View File

@ -58,11 +58,10 @@ bool Monitor_Ephemeris_Udp_Sink::write_galileo_ephemeris(const std::shared_ptr<G
for (const auto& endpoint : endpoints)
{
socket.open(endpoint.protocol(), error);
socket.connect(endpoint, error);
try
{
if (socket.send(boost::asio::buffer(outbound_data)) == 0)
if (socket.send_to(boost::asio::buffer(outbound_data), endpoint) == 0)
{
return false;
}
@ -95,11 +94,10 @@ bool Monitor_Ephemeris_Udp_Sink::write_gps_ephemeris(const std::shared_ptr<Gps_E
for (const auto& endpoint : endpoints)
{
socket.open(endpoint.protocol(), error);
socket.connect(endpoint, error);
try
{
if (socket.send(boost::asio::buffer(outbound_data)) == 0)
if (socket.send_to(boost::asio::buffer(outbound_data), endpoint) == 0)
{
return false;
}

View File

@ -57,11 +57,10 @@ bool Monitor_Pvt_Udp_Sink::write_monitor_pvt(const Monitor_Pvt* const monitor_pv
for (const auto& endpoint : endpoints)
{
socket.open(endpoint.protocol(), error);
socket.connect(endpoint, error);
try
{
if (socket.send(boost::asio::buffer(outbound_data)) == 0)
if (socket.send_to(boost::asio::buffer(outbound_data), endpoint) == 0)
{
return false;
}

View File

@ -56,11 +56,10 @@ bool Gnss_Synchro_Udp_Sink::write_gnss_synchro(const std::vector<Gnss_Synchro>&
for (const auto& endpoint : endpoints)
{
socket.open(endpoint.protocol(), error);
socket.connect(endpoint, error);
try
{
if (socket.send(boost::asio::buffer(outbound_data)) == 0)
if (socket.send_to(boost::asio::buffer(outbound_data), endpoint) == 0)
{
std::cerr << "Gnss_Synchro_Udp_Sink sent 0 bytes\n";
}