1
0
mirror of https://github.com/esphome/esphome.git synced 2025-11-19 00:05:43 +00:00

[mdns] Eliminate redundant hostname copy to save heap memory (#11734)

This commit is contained in:
J. Nick Koston
2025-11-05 12:31:19 -06:00
committed by GitHub
parent b08419fa47
commit be006ecadd
6 changed files with 11 additions and 9 deletions

View File

@@ -4,6 +4,7 @@
#include <ESP8266mDNS.h>
#include "esphome/components/network/ip_address.h"
#include "esphome/components/network/util.h"
#include "esphome/core/application.h"
#include "esphome/core/hal.h"
#include "esphome/core/log.h"
#include "mdns_component.h"
@@ -20,7 +21,7 @@ void MDNSComponent::setup() {
this->compile_records_(services);
#endif
MDNS.begin(this->hostname_.c_str());
MDNS.begin(App.get_name().c_str());
for (const auto &service : services) {
// Strip the leading underscore from the proto and service_type. While it is