Skip to content

Commit

Permalink
bugfix: HTTPD start fails due to incorrect configuration
Browse files Browse the repository at this point in the history
HomeKit code was starting HTTP Server with some fixed configuration.
Newer esp-idf versions (v5.2) introduced some new configurations that
were staying un-initiased, causing http server to fail to start.
Initialising with HTTPD_DEFAULT_CONFIG and then overriding relevant
values fixes the issue.

Closes: #123

Closes: #127
  • Loading branch information
shahpiyushv committed Feb 14, 2024
1 parent bd236e7 commit 24e4265
Showing 1 changed file with 13 additions and 13 deletions.
26 changes: 13 additions & 13 deletions components/homekit/esp_hap_platform/src/hap_platform_httpd.c
Original file line number Diff line number Diff line change
Expand Up @@ -26,19 +26,19 @@
httpd_handle_t *int_handle;
int hap_platform_httpd_start(httpd_handle_t *handle)
{
httpd_config_t config = {
.task_priority = tskIDLE_PRIORITY+5,
.stack_size = CONFIG_HAP_HTTP_STACK_SIZE,
.server_port = CONFIG_HAP_HTTP_SERVER_PORT,
.ctrl_port = CONFIG_HAP_HTTP_CONTROL_PORT,
.max_open_sockets = CONFIG_HAP_HTTP_MAX_OPEN_SOCKETS,
.max_uri_handlers = CONFIG_HAP_HTTP_MAX_URI_HANDLERS,
.max_resp_headers = 8,
.backlog_conn = 5,
.lru_purge_enable = true,
.recv_wait_timeout = 5,
.send_wait_timeout = 5,
};
httpd_config_t config = HTTPD_DEFAULT_CONFIG();
config.task_priority = tskIDLE_PRIORITY+5;
config.stack_size = CONFIG_HAP_HTTP_STACK_SIZE;
config.server_port = CONFIG_HAP_HTTP_SERVER_PORT;
config.ctrl_port = CONFIG_HAP_HTTP_CONTROL_PORT;
config.max_open_sockets = CONFIG_HAP_HTTP_MAX_OPEN_SOCKETS;
config.max_uri_handlers = CONFIG_HAP_HTTP_MAX_URI_HANDLERS;
config.max_resp_headers = 8;
config.backlog_conn = 5;
config.lru_purge_enable = true;
config.recv_wait_timeout = 5;
config.send_wait_timeout = 5;

esp_err_t err = httpd_start(handle, &config);
if (err == ESP_OK) {
int_handle = handle;
Expand Down

0 comments on commit 24e4265

Please sign in to comment.