Skip to content

Commit c3bfcc0

Browse files
Silence error sending msg over udp[CPP-489] (#343)
1 parent 0d5a46d commit c3bfcc0

File tree

1 file changed

+5
-4
lines changed

1 file changed

+5
-4
lines changed

console_backend/src/advanced_networking_tab.rs

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -16,8 +16,8 @@ use crate::shared_state::{AdvancedNetworkingState, SharedState};
1616
use crate::types::{MsgSender, Result};
1717
use crate::utils::{bytes_to_human_readable, serialize_capnproto_builder};
1818

19-
const DEFAULT_UDP_LOCAL_ADDRESS: &str = "127.0.0.1";
20-
const DEFAULT_UDP_LOCAL_PORT: u16 = 34254;
19+
const DEFAULT_UDP_LOCAL_ADDRESS: &str = "0.0.0.0";
20+
const DEFAULT_UDP_LOCAL_PORT: u16 = 0;
2121
const DEFAULT_UDP_ADDRESS: &str = "127.0.0.1";
2222
const DEFAULT_UDP_PORT: u16 = 13320;
2323
const PPP0_HACK_STR: &str = "---";
@@ -161,8 +161,8 @@ impl AdvancedNetworkingTab {
161161
if let Some(client) = &mut self.client {
162162
if self.all_messages || OBS_MSGS.contains(&msg.message_type()) {
163163
if let Ok(frame) = sbp::to_vec(msg) {
164-
if let Err(err) = client.send(&frame) {
165-
error!("Error sending to device: {}", err);
164+
if let Err(_e) = client.send(&frame) {
165+
// Need to squelch error for the case of no client listening.
166166
}
167167
}
168168
}
@@ -183,6 +183,7 @@ impl AdvancedNetworkingTab {
183183
DEFAULT_UDP_LOCAL_ADDRESS, DEFAULT_UDP_LOCAL_PORT
184184
))?;
185185
socket.set_nonblocking(true)?;
186+
socket.set_broadcast(true)?;
186187
socket.connect(format!("{}:{}", self.ip_ad.as_str(), self.port))?;
187188
self.client = Some(socket);
188189
self.running = true;

0 commit comments

Comments
 (0)