From e678ccb8b30421ad724bf6b2a04c30f96e4d492d Mon Sep 17 00:00:00 2001 From: Valentin Haudiquet Date: Thu, 12 Mar 2026 18:12:36 +0100 Subject: [PATCH] fix: use max connection count as max client count --- main/config.h | 1 - main/web_server.c | 8 ++++---- 2 files changed, 4 insertions(+), 5 deletions(-) diff --git a/main/config.h b/main/config.h index 988bdb0..c4bc989 100644 --- a/main/config.h +++ b/main/config.h @@ -72,7 +72,6 @@ static const bmc_gpio_def_t bmc_gpio_defaults[BMC_GPIO_COUNT] = { // Power Control Timing // ============================================================================ #define BMC_RESET_PULSE_MS 200 -#define BMC_POWER_GOOD_DELAY_MS 2000 // ============================================================================ // Logging Tags diff --git a/main/web_server.c b/main/web_server.c index 2b38e02..964d40d 100644 --- a/main/web_server.c +++ b/main/web_server.c @@ -11,6 +11,8 @@ #include static const char *TAG = TAG_HTTP; +#define MAX_WS_COUNT_CLIENTS BMC_HTTP_MAX_CONN +#define MAX_WS_BROADCAST_CLIENTS BMC_HTTP_MAX_CONN // Server handle static httpd_handle_t server = NULL; @@ -946,8 +948,7 @@ esp_err_t web_server_ws_broadcast(const uint8_t *data, size_t len) { .final = true, }; -// Use a fixed-size array to avoid stack issues -#define MAX_WS_BROADCAST_CLIENTS 4 + // Use a fixed-size array to avoid stack issues int client_fds[MAX_WS_BROADCAST_CLIENTS]; size_t clients = MAX_WS_BROADCAST_CLIENTS; @@ -955,7 +956,7 @@ esp_err_t web_server_ws_broadcast(const uint8_t *data, size_t len) { esp_err_t ret = httpd_get_client_list(server, &clients, client_fds); if (ret != ESP_OK) { // This can happen when there are no clients or server is busy - not a critical error - ESP_LOGD(TAG, "Could not get client list: %s (may be no clients connected)", esp_err_to_name(ret)); + ESP_LOGI(TAG, "Could not get client list: %s (may be no clients connected)", esp_err_to_name(ret)); return ESP_OK; // Return OK since this is not a critical error } @@ -987,7 +988,6 @@ int web_server_ws_client_count(void) { return 0; } -#define MAX_WS_COUNT_CLIENTS 4 int client_fds[MAX_WS_COUNT_CLIENTS]; size_t clients = MAX_WS_COUNT_CLIENTS; int count = 0;