[web_server] Consolidate duplicate client connection checks (saves 288 bytes of flash) (#11116)

This commit is contained in:
J. Nick Koston
2025-10-13 08:01:47 -10:00
committed by GitHub
parent 59f728488e
commit be2c859df3
3 changed files with 10 additions and 76 deletions

View File

@@ -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);