From c01699f2a41adca6368d623ea420107b181d5955 Mon Sep 17 00:00:00 2001 From: "J. Nick Koston" Date: Thu, 9 Apr 2026 09:20:36 -1000 Subject: [PATCH] [socket] Move socket_loop_monitored declaration before UDP factories Fix forward declaration ordering: socket_udp_recv_loop_monitored calls socket_loop_monitored, so the latter must be declared first. --- esphome/components/socket/socket.h | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/esphome/components/socket/socket.h b/esphome/components/socket/socket.h index e9399d7a67..3d0823b170 100644 --- a/esphome/components/socket/socket.h +++ b/esphome/components/socket/socket.h @@ -88,6 +88,14 @@ std::unique_ptr socket(int domain, int type, int protocol); /// Create a socket in the newest available IP domain (IPv6 or IPv4) of the given type and protocol. std::unique_ptr socket_ip(int type, int protocol); +/// Create a socket and monitor it for data in the main loop. +/// Like socket() but also registers the socket with the Application's select() loop. +/// WARNING: These functions are NOT thread-safe. They must only be called from the main loop +/// as they register the socket file descriptor with the global Application instance. +/// NOTE: On ESP platforms, FD_SETSIZE is typically 10, limiting the number of monitored sockets. +/// File descriptors >= FD_SETSIZE will not be monitored and will log an error. +std::unique_ptr socket_loop_monitored(int domain, int type, int protocol); + /// Create a send-only UDP socket of the given domain and protocol. #ifdef USE_SOCKET_IMPL_LWIP_TCP std::unique_ptr socket_udp(int domain, int protocol); @@ -140,14 +148,6 @@ inline std::unique_ptr socket_ip_udp_recv_loop_monitored(int prot #endif } -/// Create a socket and monitor it for data in the main loop. -/// Like socket() but also registers the socket with the Application's select() loop. -/// WARNING: These functions are NOT thread-safe. They must only be called from the main loop -/// as they register the socket file descriptor with the global Application instance. -/// NOTE: On ESP platforms, FD_SETSIZE is typically 10, limiting the number of monitored sockets. -/// File descriptors >= FD_SETSIZE will not be monitored and will log an error. -std::unique_ptr socket_loop_monitored(int domain, int type, int protocol); - /// Create a listening socket of the given domain, type and protocol. /// Create a listening socket and monitor it for data in the main loop. /// Create a listening socket in the newest available IP domain and monitor it.