mirror of
https://github.com/esphome/esphome.git
synced 2026-02-28 01:44:20 -07:00
[web_server] Consolidate duplicate client connection checks (saves 288 bytes of flash) (#11116)
This commit is contained in:
@@ -412,6 +412,9 @@ void AsyncEventSource::try_send_nodefer(const char *message, const char *event,
|
||||
|
||||
void AsyncEventSource::deferrable_send_state(void *source, const char *event_type,
|
||||
message_generator_t *message_generator) {
|
||||
// Skip if no connected clients to avoid unnecessary processing
|
||||
if (this->empty())
|
||||
return;
|
||||
for (auto *ses : this->sessions_) {
|
||||
if (ses->fd_.load() != 0) { // Skip dead sessions
|
||||
ses->deferrable_send_state(source, event_type, message_generator);
|
||||
|
||||
Reference in New Issue
Block a user