diff --git a/examples/wifi-echo/server/esp32/main/EchoClient.cpp b/examples/wifi-echo/server/esp32/main/EchoClient.cpp index c96fe06781b9d9..67a0f46626eba7 100644 --- a/examples/wifi-echo/server/esp32/main/EchoClient.cpp +++ b/examples/wifi-echo/server/esp32/main/EchoClient.cpp @@ -15,6 +15,8 @@ * limitations under the License. */ +#ifdef CONFIG_ECHO_USE_CLIENT + #include "esp_event.h" #include "esp_log.h" #include "esp_system.h" @@ -43,7 +45,6 @@ static const char * PAYLOAD = "Message from echo client!"; static void udp_client_task(void * pvParameters) { -#if CONFIG_USE_ECHO_CLIENT char rx_buffer[RX_LEN]; char host_ip[] = HOST_IP_ADDR; int addr_family = 0; @@ -108,13 +109,12 @@ static void udp_client_task(void * pvParameters) } } vTaskDelete(NULL); -#endif } // The echo client assumes the platform's networking has been setup already void startClient(void) { -#if CONFIG_USE_ECHO_CLIENT xTaskCreate(udp_client_task, "udp_client", 4096, (void *) AF_INET, 5, NULL); -#endif } + +#endif // CONFIG_USE_ECHO_CLIENT diff --git a/examples/wifi-echo/server/esp32/main/wifi-echo.cpp b/examples/wifi-echo/server/esp32/main/wifi-echo.cpp index 9aaa9163df864f..7a7b4a33a88113 100644 --- a/examples/wifi-echo/server/esp32/main/wifi-echo.cpp +++ b/examples/wifi-echo/server/esp32/main/wifi-echo.cpp @@ -42,7 +42,9 @@ using namespace ::chip; using namespace ::chip::DeviceLayer; extern void startServer(SecureSessionMgr * transportIPv4, SecureSessionMgr * transportIPv6); +#if CONFIG_USE_ECHO_CLIENT extern void startClient(void); +#endif // CONFIG_USE_ECHO_CLIENT #if CONFIG_DEVICE_TYPE_M5STACK