feat: lock production decisions and resource budgets
This commit is contained in:
+4
-3
@@ -38,6 +38,7 @@ enum {
|
||||
kCapacityShipsPerBoard = 10,
|
||||
kCapacityTickMs = 25,
|
||||
kMaxStateMessageBytes = 512,
|
||||
kHttpMaxOpenSockets = 12,
|
||||
};
|
||||
|
||||
typedef struct {
|
||||
@@ -186,8 +187,8 @@ static esp_err_t send_state(httpd_handle_t server, int fd, view_role_t role) {
|
||||
|
||||
static void broadcast_state(void *unused) {
|
||||
(void)unused;
|
||||
size_t count = 4;
|
||||
int clients[4];
|
||||
size_t count = kHttpMaxOpenSockets;
|
||||
int clients[kHttpMaxOpenSockets];
|
||||
if (httpd_get_client_list(s_server, &count, clients) != ESP_OK) return;
|
||||
for (size_t index = 0; index < count; ++index) {
|
||||
if (httpd_ws_get_fd_info(s_server, clients[index]) == HTTPD_WS_CLIENT_WEBSOCKET) {
|
||||
@@ -571,7 +572,7 @@ static esp_err_t start_http_server(void) {
|
||||
httpd_handle_t server = NULL;
|
||||
httpd_config_t config = HTTPD_DEFAULT_CONFIG();
|
||||
config.max_uri_handlers = 7;
|
||||
config.max_open_sockets = 12;
|
||||
config.max_open_sockets = kHttpMaxOpenSockets;
|
||||
config.uri_match_fn = httpd_uri_match_wildcard;
|
||||
config.lru_purge_enable = true;
|
||||
ESP_RETURN_ON_ERROR(httpd_start(&server, &config), kLogTag, "http server start failed");
|
||||
|
||||
Reference in New Issue
Block a user