diff --git a/esphome/components/web_server/web_server.cpp b/esphome/components/web_server/web_server.cpp index faa2c728ca..20ff1a7c29 100644 --- a/esphome/components/web_server/web_server.cpp +++ b/esphome/components/web_server/web_server.cpp @@ -125,15 +125,15 @@ void DeferredUpdateEventSource::process_deferred_queue_() { if (this->send(message.c_str(), "state") != DISCARDED) { // O(n) but memory efficiency is more important than speed here which is why std::vector was chosen deferred_queue_.erase(deferred_queue_.begin()); - consecutive_send_failures_ = 0; // Reset failure count on successful send + this->consecutive_send_failures_ = 0; // Reset failure count on successful send } else { - consecutive_send_failures_++; - if (consecutive_send_failures_ >= MAX_CONSECUTIVE_SEND_FAILURES) { + this->consecutive_send_failures_++; + if (this->consecutive_send_failures_ >= MAX_CONSECUTIVE_SEND_FAILURES) { // Too many failures, connection is likely dead ESP_LOGW(TAG, "Closing stuck EventSource connection after %" PRIu16 " failed sends", - consecutive_send_failures_); + this->consecutive_send_failures_); this->close(); - deferred_queue_.clear(); + this->deferred_queue_.clear(); } break; } @@ -174,7 +174,7 @@ void DeferredUpdateEventSource::deferrable_send_state(void *source, const char * if (this->send(message.c_str(), "state") == DISCARDED) { deq_push_back_with_dedup_(source, message_generator); } else { - consecutive_send_failures_ = 0; // Reset failure count on successful send + this->consecutive_send_failures_ = 0; // Reset failure count on successful send } } }