mirror of
https://github.com/esphome/esphome.git
synced 2025-10-29 22:24:26 +00:00
[mdns][openthread] Use StaticVector for services storage with compile-time capacity (#10976)
This commit is contained in:
@@ -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");
|
||||
|
||||
@@ -57,7 +57,6 @@ class OpenThreadSrpComponent : public Component {
|
||||
|
||||
protected:
|
||||
esphome::mdns::MDNSComponent *mdns_{nullptr};
|
||||
std::vector<esphome::mdns::MDNSService> mdns_services_;
|
||||
std::vector<std::unique_ptr<uint8_t[]>> memory_pool_;
|
||||
void *pool_alloc_(size_t size);
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user