forked from NationTech/harmony
feat(inventory agent): Local presence advertisement and discovery now works! Must be within the same LAN to share the multicast address though
This commit is contained in:
@@ -16,7 +16,7 @@ pub fn discover_agents(timeout: Option<u64>, on_event: fn(&DiscoveryEvent)) {
|
||||
while let Ok(event) = receiver.recv() {
|
||||
on_event(&event);
|
||||
match event {
|
||||
ServiceEvent::ServiceData(resolved) => {
|
||||
ServiceEvent::ServiceResolved(resolved) => {
|
||||
println!("Resolved a new service: {}", resolved.fullname);
|
||||
}
|
||||
other_event => {
|
||||
@@ -27,8 +27,8 @@ pub fn discover_agents(timeout: Option<u64>, on_event: fn(&DiscoveryEvent)) {
|
||||
});
|
||||
|
||||
if let Some(timeout) = timeout {
|
||||
// Gracefully shutdown the daemon.
|
||||
std::thread::sleep(std::time::Duration::from_secs(timeout));
|
||||
mdns.shutdown().unwrap();
|
||||
// Gracefully shutdown the daemon.
|
||||
std::thread::sleep(std::time::Duration::from_secs(timeout));
|
||||
mdns.shutdown().unwrap();
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user