1
0
mirror of https://github.com/esphome/esphome.git synced 2025-10-19 18:23:46 +01:00

[mdns][openthread] Use StaticVector for services storage with compile-time capacity (#10976)

This commit is contained in:
J. Nick Koston
2025-10-05 15:30:17 -05:00
committed by GitHub
parent 19439199cc
commit 0fd71ca211
7 changed files with 44 additions and 51 deletions

View File

@@ -143,11 +143,10 @@ void OpenThreadSrpComponent::setup() {
return;
}
// Copy the mdns services to our local instance so that the c_str pointers remain valid for the lifetime of this
// component
this->mdns_services_ = this->mdns_->get_services();
ESP_LOGD(TAG, "Setting up SRP services. count = %d\n", this->mdns_services_.size());
for (const auto &service : this->mdns_services_) {
// Get mdns services and copy their data (strings are copied with strdup below)
const auto &mdns_services = this->mdns_->get_services();
ESP_LOGD(TAG, "Setting up SRP services. count = %d\n", mdns_services.size());
for (const auto &service : mdns_services) {
otSrpClientBuffersServiceEntry *entry = otSrpClientBuffersAllocateService(instance);
if (!entry) {
ESP_LOGW(TAG, "Failed to allocate service entry");