Update with fork for zeroconf
This commit is contained in:
parent
65661f13db
commit
b93875658b
2 changed files with 16 additions and 7 deletions
|
@ -78,7 +78,7 @@ x509-cert = { version = "0.2.0", default-features = false, features = ["pem"], o
|
||||||
astro-dnssd = { version = "0.3" }
|
astro-dnssd = { version = "0.3" }
|
||||||
|
|
||||||
[target.'cfg(target_os = "linux")'.dependencies]
|
[target.'cfg(target_os = "linux")'.dependencies]
|
||||||
zeroconf = { version = "0.11.1", optional = true }
|
zeroconf = { version = "0.11.1", optional = true, path = "../../zeroconf-rs/zeroconf" }
|
||||||
|
|
||||||
[target.'cfg(not(target_os = "espidf"))'.dependencies]
|
[target.'cfg(not(target_os = "espidf"))'.dependencies]
|
||||||
mbedtls = { version = "0.9", optional = true }
|
mbedtls = { version = "0.9", optional = true }
|
||||||
|
|
|
@ -54,14 +54,22 @@ impl<'a> MdnsService<'a> {
|
||||||
let _ = self.remove(name);
|
let _ = self.remove(name);
|
||||||
|
|
||||||
mode.service(self.dev_det, self.matter_port, name, |service| {
|
mode.service(self.dev_det, self.matter_port, name, |service| {
|
||||||
|
let name = service.service.strip_prefix('_').unwrap_or(service.service);
|
||||||
|
let protocol = service
|
||||||
|
.protocol
|
||||||
|
.strip_prefix('_')
|
||||||
|
.unwrap_or(service.protocol);
|
||||||
|
|
||||||
let service_type = if !service.service_subtypes.is_empty() {
|
let service_type = if !service.service_subtypes.is_empty() {
|
||||||
ServiceType::with_sub_types(
|
let subtypes = service
|
||||||
service.service,
|
.service_subtypes
|
||||||
service.protocol,
|
.into_iter()
|
||||||
Vec::from(service.service_subtypes),
|
.map(|subtype| subtype.strip_prefix('_').unwrap_or(*subtype))
|
||||||
)
|
.collect();
|
||||||
|
|
||||||
|
ServiceType::with_sub_types(name, protocol, subtypes)
|
||||||
} else {
|
} else {
|
||||||
ServiceType::new(service.service, service.protocol)
|
ServiceType::new(name, protocol)
|
||||||
}
|
}
|
||||||
.map_err(|err| {
|
.map_err(|err| {
|
||||||
log::error!(
|
log::error!(
|
||||||
|
@ -93,6 +101,7 @@ impl<'a> MdnsService<'a> {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
mdns_service.set_txt_record(txt_record);
|
mdns_service.set_txt_record(txt_record);
|
||||||
|
mdns_service.set_registered_callback(Box::new(|_, _| {}));
|
||||||
|
|
||||||
match mdns_service.register() {
|
match mdns_service.register() {
|
||||||
Ok(event_loop) => loop {
|
Ok(event_loop) => loop {
|
||||||
|
|
Loading…
Add table
Reference in a new issue