Skip to content

Commit

Permalink
fix: Add warning to enable LWIP_NETIF_LOOPBACK to use control socket API
Browse files Browse the repository at this point in the history
Closes #13659
  • Loading branch information
hmalpani committed May 20, 2024
1 parent 54ee9bf commit 52ca696
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion components/esp_http_server/src/util/ctrl_sock.c
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* SPDX-FileCopyrightText: 2018-2021 Espressif Systems (Shanghai) CO LTD
* SPDX-FileCopyrightText: 2018-2024 Espressif Systems (Shanghai) CO LTD
*
* SPDX-License-Identifier: Apache-2.0
*/
Expand All @@ -11,13 +11,19 @@
#include <netinet/in.h>
#include <arpa/inet.h>

#include "esp_log.h"
#include "ctrl_sock.h"

/* Control socket, because in some network stacks select can't be woken up any
* other way
*/
int cs_create_ctrl_sock(int port)
{
#if !CONFIG_LWIP_NETIF_LOOPBACK
ESP_LOGE(TAG, "Please enable LWIP_NETIF_LOOPBACK for %s API", __func__);
return -1;
#endif

int fd = socket(AF_INET, SOCK_DGRAM, IPPROTO_UDP);
if (fd < 0) {
return -1;
Expand Down

0 comments on commit 52ca696

Please sign in to comment.