From 1c26bb3e93c4ee47977319fff9076bab75413a4f Mon Sep 17 00:00:00 2001 From: Walker Crouse Date: Fri, 20 Aug 2021 13:20:20 -0400 Subject: [PATCH] Fix ServiceType for macOS Signed-off-by: Walker Crouse --- examples/Cargo.lock | 2 +- zeroconf/src/macos/browser.rs | 3 ++- zeroconf/src/macos/service.rs | 3 ++- 3 files changed, 5 insertions(+), 3 deletions(-) diff --git a/examples/Cargo.lock b/examples/Cargo.lock index 219b55b..97fce50 100644 --- a/examples/Cargo.lock +++ b/examples/Cargo.lock @@ -502,7 +502,7 @@ checksum = "712e227841d057c1ee1cd2fb22fa7e5a5461ae8e48fa2ca79ec42cfc1931183f" [[package]] name = "zeroconf" -version = "0.8.2" +version = "0.9.2" dependencies = [ "avahi-sys", "bonjour-sys", diff --git a/zeroconf/src/macos/browser.rs b/zeroconf/src/macos/browser.rs index 6b9bda4..f39f38e 100644 --- a/zeroconf/src/macos/browser.rs +++ b/zeroconf/src/macos/browser.rs @@ -265,10 +265,11 @@ unsafe fn handle_get_address_info( let hostname = c_str::copy_raw(hostname); let domain = bonjour_util::normalize_domain(&ctx.resolved_domain.take().unwrap()); + let kind = bonjour_util::normalize_domain(&ctx.resolved_kind.take().unwrap()); let result = ServiceDiscovery::builder() .name(ctx.resolved_name.take().unwrap()) - .service_type(ServiceType::from_str(&ctx.resolved_kind.take().unwrap())?) + .service_type(ServiceType::from_str(&kind)?) .domain(domain) .host_name(hostname) .address(ip) diff --git a/zeroconf/src/macos/service.rs b/zeroconf/src/macos/service.rs index 033fdec..cedab4a 100644 --- a/zeroconf/src/macos/service.rs +++ b/zeroconf/src/macos/service.rs @@ -158,10 +158,11 @@ unsafe fn handle_register( } let domain = bonjour_util::normalize_domain(c_str::raw_to_str(domain)); + let kind = bonjour_util::normalize_domain(c_str::raw_to_str(regtype)); let result = ServiceRegistration::builder() .name(c_str::copy_raw(name)) - .service_type(ServiceType::from_str(&c_str::copy_raw(regtype))?) + .service_type(ServiceType::from_str(&kind)?) .domain(domain) .build() .expect("could not build ServiceRegistration");