1
0
mirror of https://github.com/esphome/esphome.git synced 2025-09-26 23:22:21 +01:00

[api] Reduce memory usage by eliminating duplicate client info strings (#9740)

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
This commit is contained in:
J. Nick Koston
2025-07-20 13:34:59 -10:00
committed by GitHub
parent ecd310dae1
commit 5b5982cfdd
5 changed files with 53 additions and 38 deletions

View File

@@ -184,9 +184,9 @@ void APIServer::loop() {
// Rare case: handle disconnection
#ifdef USE_API_CLIENT_DISCONNECTED_TRIGGER
this->client_disconnected_trigger_->trigger(client->client_info_, client->client_peername_);
this->client_disconnected_trigger_->trigger(client->client_info_.name, client->client_info_.peername);
#endif
ESP_LOGV(TAG, "Remove connection %s", client->client_info_.c_str());
ESP_LOGV(TAG, "Remove connection %s", client->client_info_.name.c_str());
// Swap with the last element and pop (avoids expensive vector shifts)
if (client_index < this->clients_.size() - 1) {