From 03c869bd432faa5e3307d903b7032e258ef920db Mon Sep 17 00:00:00 2001 From: "J. Nick Koston" Date: Wed, 1 Oct 2025 23:05:59 +0200 Subject: [PATCH] update comment --- esphome/components/mdns/mdns_esp32.cpp | 3 ++- esphome/components/mdns/mdns_esp8266.cpp | 3 ++- esphome/components/mdns/mdns_libretiny.cpp | 3 ++- esphome/components/mdns/mdns_rp2040.cpp | 3 ++- 4 files changed, 8 insertions(+), 4 deletions(-) diff --git a/esphome/components/mdns/mdns_esp32.cpp b/esphome/components/mdns/mdns_esp32.cpp index ffd86afec1..69a6fd3b8a 100644 --- a/esphome/components/mdns/mdns_esp32.cpp +++ b/esphome/components/mdns/mdns_esp32.cpp @@ -25,7 +25,8 @@ void MDNSComponent::setup() { mdns_hostname_set(this->hostname_.c_str()); mdns_instance_name_set(this->hostname_.c_str()); - for (const auto &service : this->services_) { + for (uint8_t i = 0; i < this->services_count_; i++) { + const auto &service = this->services_[i]; std::vector txt_records; for (const auto &record : service.txt_records) { mdns_txt_item_t it{}; diff --git a/esphome/components/mdns/mdns_esp8266.cpp b/esphome/components/mdns/mdns_esp8266.cpp index 2c90d57021..9d701fe856 100644 --- a/esphome/components/mdns/mdns_esp8266.cpp +++ b/esphome/components/mdns/mdns_esp8266.cpp @@ -16,7 +16,8 @@ void MDNSComponent::setup() { MDNS.begin(this->hostname_.c_str()); - for (const auto &service : this->services_) { + for (uint8_t i = 0; i < this->services_count_; i++) { + const auto &service = this->services_[i]; // Strip the leading underscore from the proto and service_type. While it is // part of the wire protocol to have an underscore, and for example ESP-IDF // expects the underscore to be there, the ESP8266 implementation always adds diff --git a/esphome/components/mdns/mdns_libretiny.cpp b/esphome/components/mdns/mdns_libretiny.cpp index 7a41ec9dce..7f3a05e515 100644 --- a/esphome/components/mdns/mdns_libretiny.cpp +++ b/esphome/components/mdns/mdns_libretiny.cpp @@ -16,7 +16,8 @@ void MDNSComponent::setup() { MDNS.begin(this->hostname_.c_str()); - for (const auto &service : this->services_) { + for (uint8_t i = 0; i < this->services_count_; i++) { + const auto &service = this->services_[i]; // Strip the leading underscore from the proto and service_type. While it is // part of the wire protocol to have an underscore, and for example ESP-IDF // expects the underscore to be there, the ESP8266 implementation always adds diff --git a/esphome/components/mdns/mdns_rp2040.cpp b/esphome/components/mdns/mdns_rp2040.cpp index 95894323f4..395d335ffd 100644 --- a/esphome/components/mdns/mdns_rp2040.cpp +++ b/esphome/components/mdns/mdns_rp2040.cpp @@ -16,7 +16,8 @@ void MDNSComponent::setup() { MDNS.begin(this->hostname_.c_str()); - for (const auto &service : this->services_) { + for (uint8_t i = 0; i < this->services_count_; i++) { + const auto &service = this->services_[i]; // Strip the leading underscore from the proto and service_type. While it is // part of the wire protocol to have an underscore, and for example ESP-IDF // expects the underscore to be there, the ESP8266 implementation always adds