From 8ec998ff30c57fc27d4e2fb0bfde630d05b6b1d2 Mon Sep 17 00:00:00 2001 From: "J. Nick Koston" Date: Mon, 23 Jun 2025 10:52:34 +0200 Subject: [PATCH] more api loop reductions --- esphome/components/api/api_connection.cpp | 2 +- esphome/components/api/api_server.cpp | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/esphome/components/api/api_connection.cpp b/esphome/components/api/api_connection.cpp index ef791d462c..8f814f9f42 100644 --- a/esphome/components/api/api_connection.cpp +++ b/esphome/components/api/api_connection.cpp @@ -158,7 +158,7 @@ void APIConnection::loop() { if (!this->list_entities_iterator_.completed()) this->list_entities_iterator_.advance(); - if (!this->initial_state_iterator_.completed() && this->list_entities_iterator_.completed()) + else if (!this->initial_state_iterator_.completed()) this->initial_state_iterator_.advance(); static uint8_t max_ping_retries = 60; diff --git a/esphome/components/api/api_server.cpp b/esphome/components/api/api_server.cpp index ae732fc234..8f7add646c 100644 --- a/esphome/components/api/api_server.cpp +++ b/esphome/components/api/api_server.cpp @@ -136,7 +136,7 @@ void APIServer::schedule_reboot_timeout_() { void APIServer::loop() { // Accept new clients only if the socket exists and has incoming connections - if (this->socket_ && this->socket_->ready()) { + if (this->socket_->ready()) { while (true) { struct sockaddr_storage source_addr; socklen_t addr_len = sizeof(source_addr);