From f4fbb5df2b549773af0c02dd7709fabdd783a35e Mon Sep 17 00:00:00 2001 From: Stephen Akridge Date: Thu, 3 May 2018 17:03:14 -0700 Subject: [PATCH] Fix bind so we can talk on external interfaces and surface send error --- src/accountant_skel.rs | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/src/accountant_skel.rs b/src/accountant_skel.rs index c9a7a087034f0f..b687fd69dcc64d 100644 --- a/src/accountant_skel.rs +++ b/src/accountant_skel.rs @@ -88,7 +88,7 @@ impl AccountantSkel { fn notify_entry_info_subscribers(obj: &SharedSkel, entry: &Entry) { // TODO: No need to bind(). - let socket = UdpSocket::bind("127.0.0.1:0").expect("bind"); + let socket = UdpSocket::bind("0.0.0.0:0").expect("bind"); // copy subscribers to avoid taking lock while doing io let addrs = obj.entry_info_subscribers.lock().unwrap().clone(); @@ -100,7 +100,10 @@ impl AccountantSkel { num_events: entry.events.len() as u64, }; let data = serialize(&Response::EntryInfo(entry_info)).expect("serialize EntryInfo"); - let _res = socket.send_to(&data, addr); + let res = socket.send_to(&data, addr); + if res.is_err() { + eprintln!("couldn't send response: {:?}", res); + } } }