From 39abbe609ae3b3ad2355a03360c845a53536dcfc Mon Sep 17 00:00:00 2001 From: "J. Nick Koston" Date: Tue, 13 May 2025 21:05:26 -0500 Subject: [PATCH] cleanup --- esphome/components/api/api_connection.cpp | 6 +++--- esphome/components/api/api_connection.h | 8 ++++---- 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/esphome/components/api/api_connection.cpp b/esphome/components/api/api_connection.cpp index 562709ba25..3443030a73 100644 --- a/esphome/components/api/api_connection.cpp +++ b/esphome/components/api/api_connection.cpp @@ -153,7 +153,7 @@ void APIConnection::loop() { return; } - if (this->try_to_send_buffer(true)) { + if (this->try_to_clear_buffer(true)) { this->deferred_message_queue_.process_queue(); } @@ -1535,7 +1535,7 @@ NoiseEncryptionSetKeyResponse APIConnection::noise_encryption_set_key(const Nois void APIConnection::subscribe_home_assistant_states(const SubscribeHomeAssistantStatesRequest &msg) { state_subs_at_ = 0; } -bool APIConnection::try_to_send_buffer(bool log_out_of_space) { +bool APIConnection::try_to_clear_buffer(bool log_out_of_space) { if (this->remove_) return false; if (!this->helper_->can_write_without_blocking()) { @@ -1557,7 +1557,7 @@ bool APIConnection::try_to_send_buffer(bool log_out_of_space) { } } bool APIConnection::send_buffer(ProtoWriteBuffer buffer, uint32_t message_type) { - if (!this->try_to_send_buffer(message_type != 29)) { // SubscribeLogsResponse + if (!this->try_to_clear_buffer(message_type != 29)) { // SubscribeLogsResponse return false; } diff --git a/esphome/components/api/api_connection.h b/esphome/components/api/api_connection.h index e3c5805213..08061ade4c 100644 --- a/esphome/components/api/api_connection.h +++ b/esphome/components/api/api_connection.h @@ -411,7 +411,7 @@ class APIConnection : public APIServerConnection { this->proto_write_buffer_.reserve(reserve_size); return {&this->proto_write_buffer_}; } - bool try_to_send_buffer(bool log_out_of_space); + bool try_to_clear_buffer(bool log_out_of_space); bool send_buffer(ProtoWriteBuffer buffer, uint32_t message_type) override; std::string get_client_combined_info() const { return this->client_combined_info_; } @@ -434,7 +434,7 @@ class APIConnection : public APIServerConnection { template bool send_state_(EntityT *entity, bool (APIConnection::*try_send_func)(EntityT *)) { if (!this->state_subscription_) return false; - if (this->try_to_send_buffer() && (this->*try_send_func)(entity)) { + if (this->try_to_clear_buffer() && (this->*try_send_func)(entity)) { return true; } this->deferred_message_queue_.defer(entity, reinterpret_cast(try_send_func)); @@ -464,7 +464,7 @@ class APIConnection : public APIServerConnection { Args... args) { if (!this->state_subscription_) return false; - if (this->try_to_send_buffer() && (this->*try_send_state_func)(entity, state, args...)) { + if (this->try_to_clear_buffer() && (this->*try_send_state_func)(entity, state, args...)) { return true; } this->deferred_message_queue_.defer(entity, reinterpret_cast(try_send_entity_func)); @@ -479,7 +479,7 @@ class APIConnection : public APIServerConnection { * @param try_send_func The function that tries to send the info */ template void send_info_(EntityT *entity, bool (APIConnection::*try_send_func)(EntityT *)) { - if (this->try_to_send_buffer() && (this->*try_send_func)(entity)) { + if (this->try_to_clear_buffer() && (this->*try_send_func)(entity)) { return; } this->deferred_message_queue_.defer(entity, reinterpret_cast(try_send_func));