Update with service name
This commit is contained in:
parent
b93875658b
commit
c064fb12a4
2 changed files with 7 additions and 4 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, path = "../../zeroconf-rs/zeroconf" }
|
zeroconf = { version = "0.11.1", optional = true, git = "https://github.com/ssnover/zeroconf-rs" }
|
||||||
|
|
||||||
[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,7 +54,7 @@ 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 service_name = service.service.strip_prefix('_').unwrap_or(service.service);
|
||||||
let protocol = service
|
let protocol = service
|
||||||
.protocol
|
.protocol
|
||||||
.strip_prefix('_')
|
.strip_prefix('_')
|
||||||
|
@ -67,9 +67,9 @@ impl<'a> MdnsService<'a> {
|
||||||
.map(|subtype| subtype.strip_prefix('_').unwrap_or(*subtype))
|
.map(|subtype| subtype.strip_prefix('_').unwrap_or(*subtype))
|
||||||
.collect();
|
.collect();
|
||||||
|
|
||||||
ServiceType::with_sub_types(name, protocol, subtypes)
|
ServiceType::with_sub_types(service_name, protocol, subtypes)
|
||||||
} else {
|
} else {
|
||||||
ServiceType::new(name, protocol)
|
ServiceType::new(service_name, protocol)
|
||||||
}
|
}
|
||||||
.map_err(|err| {
|
.map_err(|err| {
|
||||||
log::error!(
|
log::error!(
|
||||||
|
@ -87,6 +87,8 @@ impl<'a> MdnsService<'a> {
|
||||||
txt_kvs.push((k.to_string(), v.to_string()));
|
txt_kvs.push((k.to_string(), v.to_string()));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
let name_copy = name.to_owned();
|
||||||
|
|
||||||
std::thread::spawn(move || {
|
std::thread::spawn(move || {
|
||||||
let mut mdns_service = zeroconf::MdnsService::new(service_type, service_port);
|
let mut mdns_service = zeroconf::MdnsService::new(service_type, service_port);
|
||||||
|
|
||||||
|
@ -100,6 +102,7 @@ impl<'a> MdnsService<'a> {
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
mdns_service.set_name(&name_copy);
|
||||||
mdns_service.set_txt_record(txt_record);
|
mdns_service.set_txt_record(txt_record);
|
||||||
mdns_service.set_registered_callback(Box::new(|_, _| {}));
|
mdns_service.set_registered_callback(Box::new(|_, _| {}));
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue