esp_http_server: fix default control port for HTTPS configuration

For simultaneous HTTP and HTTPS server use-case, default configurations
set same control socket port and hence one of the server initialization
fails with an error "error in creating control socket".

This commit modifies default initializers to use different control
socket port in HTTP vs HTTPS server case.

Closes https://github.com/espressif/esp-idf/issues/10160
Closes IDFGH-8719
This commit is contained in:
Mahavir Jain
2022-11-14 17:48:21 +05:30
parent 73724b0d41
commit 34f3287323
2 changed files with 4 additions and 2 deletions

View File

@@ -19,6 +19,8 @@
extern "C" { extern "C" {
#endif #endif
#define ESP_HTTPD_DEF_CTRL_PORT (32768) /*!< HTTP Server control socket port*/
/* /*
note: esp_https_server.h includes a customized copy of this note: esp_https_server.h includes a customized copy of this
initializer that should be kept in sync initializer that should be kept in sync
@@ -28,7 +30,7 @@ initializer that should be kept in sync
.stack_size = 4096, \ .stack_size = 4096, \
.core_id = tskNO_AFFINITY, \ .core_id = tskNO_AFFINITY, \
.server_port = 80, \ .server_port = 80, \
.ctrl_port = 32768, \ .ctrl_port = ESP_HTTPD_DEF_CTRL_PORT, \
.max_open_sockets = 7, \ .max_open_sockets = 7, \
.max_uri_handlers = 8, \ .max_uri_handlers = 8, \
.max_resp_headers = 8, \ .max_resp_headers = 8, \

View File

@@ -122,7 +122,7 @@ typedef struct httpd_ssl_config httpd_ssl_config_t;
.stack_size = 10240, \ .stack_size = 10240, \
.core_id = tskNO_AFFINITY, \ .core_id = tskNO_AFFINITY, \
.server_port = 0, \ .server_port = 0, \
.ctrl_port = 32768, \ .ctrl_port = ESP_HTTPD_DEF_CTRL_PORT+1, \
.max_open_sockets = 4, \ .max_open_sockets = 4, \
.max_uri_handlers = 8, \ .max_uri_handlers = 8, \
.max_resp_headers = 8, \ .max_resp_headers = 8, \