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:
2025-08-29 11:22:44 -04:00
parent b857412151
commit 05e7b8075c
10 changed files with 154 additions and 30 deletions

View File

@@ -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();
}
}