Fix ServiceType for macOS

Signed-off-by: Walker Crouse <walkercrouse@hotmail.com>
This commit is contained in:
Walker Crouse 2021-08-20 13:20:20 -04:00
parent 9f3099311c
commit 1c26bb3e93
3 changed files with 5 additions and 3 deletions

2
examples/Cargo.lock generated
View File

@ -502,7 +502,7 @@ checksum = "712e227841d057c1ee1cd2fb22fa7e5a5461ae8e48fa2ca79ec42cfc1931183f"
[[package]]
name = "zeroconf"
version = "0.8.2"
version = "0.9.2"
dependencies = [
"avahi-sys",
"bonjour-sys",

View File

@ -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)

View File

@ -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");