Prefix the poll result enumerators, report a reset after connect as ECONNRESET, and test the set_sockaddr contract on host

This commit is contained in:
J. Nick Koston
2026-09-05 15:39:31 +02:00
parent 457e224e19
commit 329dec0e9a
7 changed files with 84 additions and 19 deletions
@@ -0,0 +1,18 @@
esphome:
name: socket-set-sockaddr
on_boot:
then:
- lambda: |-
// Exercise the contract callers rely on: 0 for text that is not an
// address, the sockaddr length otherwise, broadcast included
struct sockaddr_storage addr;
auto *sa = reinterpret_cast<struct sockaddr *>(&addr);
ESP_LOGI("test", "SET_SOCKADDR invalid=%u valid=%u broadcast=%u",
(unsigned) socket::set_sockaddr(sa, sizeof(addr), "not an address", 1234),
(unsigned) socket::set_sockaddr(sa, sizeof(addr), "192.0.2.1", 1234),
(unsigned) socket::set_sockaddr(sa, sizeof(addr), "255.255.255.255", 1234));
host:
api:
logger:
level: INFO