You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
facade: shared/happy-eyeballs: move 8 platform conditionals into happy-eyeballs-<os> files #880
Winsock vs BSD sockets differences in the Happy Eyeballs connector.
Class totals: (a) movable 8, (b) stays - public header 0, (c) Rust-ported 0. Total: 8. Line numbers on origin/master.
file:line
macro
branch
class
proposed function / target
shared/happy-eyeballs/happy-eyeballs.c:31
_WIN32
winsock2 includes + MSVC pragma / snprintf alias
a
happy-eyeballs-sock.h dispatching to -windows.h / -posix.h
shared/happy-eyeballs/happy-eyeballs.c:32
_MSC_VER
disable 4996 warning
a
inside happy-eyeballs-windows.h
shared/happy-eyeballs/happy-eyeballs.c:38
_MSC_VER
#define snprintf _snprintf
a
inside happy-eyeballs-windows.h
shared/happy-eyeballs/happy-eyeballs.c:169
_WIN32
COMODO sandbox: gethostbyname("localhost") probe
a
he_platform_dns_probe() in happy-eyeballs-windows.c
shared/happy-eyeballs/happy-eyeballs.c:343
!_WIN32 && SO_NOSIGPIPE
setsockopt SO_NOSIGPIPE (BSD/macOS)
a
he_socket_set_nosigpipe(fd) in -posix.c
shared/happy-eyeballs/happy-eyeballs.c:406
_WIN32
WSASocket overlapped vs socket()
a
he_socket_create(family)
shared/happy-eyeballs/happy-eyeballs.c:626
_WIN32
SHUT_RDWR=SD_BOTH vs closesocket=close
a
in -windows.h / -posix.h
shared/happy-eyeballs/happy-eyeballs.h:37
_WIN32
include winsock2/ws2tcpip vs sys/socket
a
happy-eyeballs-sock.h
Classes: (a) movable behind per-platform files; (b) public-header ABI/export/type selection, stays; (c) already replaced by the Rust port (platform code isolated in src/platform/). Macro column abbreviates the #if expression; ! means negated, elif means an #elif line.
Test approach: No existing tests; add a characterization test (loopback connect against a local server) on Tier 2 Linux plus Windows native build via ci-full.
Each move is one function per facade entry, mechanical, so upstream merges stay manageable; the ratchet baseline (step 1) drops by the moved count.
Characterization test first: test_happy_eyeballs (cmocka, Tier 2), loopback connect to a local listener over IPv4 and IPv6, a refused port, and an unresolvable host. It must pass before and after the move.
Move the 8 conditionals. The issue suggests a happy-eyeballs-sock.h that dispatches to -windows.h/-posix.h, but that dispatcher would itself be an #ifdef in a shared file, which ci: ratchet lint for platform conditionals in shared C/C++ (#847 step 1) #848's policy bans. Instead CMake picks the platform half: shared code includes he-platform.h and calls he_platform_*(); platform/windows/ and platform/posix/ each hold he-platform.h + he-platform.c, and shared/happy-eyeballs/CMakeLists.txt adds the right directory and source per OS. happy-eyeballs.h's socket-type include moves the same way. Shared files end with zero platform conditionals.
ci-full label so the Windows and macOS builds run.
@zackees (#848): will */platform/windows/ and */platform/posix/ be in the blessed-directory allowlist, or do you want -windows/-nix file names instead? I'll follow whichever #848 lands with.
Naming answered by #900 (the merged #848 ratchet): a path is blessed when any of its tokens is a platform word, and windows and posix are both in PLATFORM_TOKENS, so shared/happy-eyeballs/platform/windows/ and platform/posix/ work as planned. Baseline today: happy-eyeballs.c 7, happy-eyeballs.h 1; the move takes both to 0 and drops them from ci/platform-ifdef-baseline.json. Starting the move on #910 once #918 (#903) merges, so the moved code carries that fix.
Done: #910 moved the 8 platform conditionals in shared/happy-eyeballs into platform/windows/ and platform/posix/ (happy-eyeballs-socket.h for the public header's socket types, happy-eyeballs-platform.h for the rest), with CMake picking the directory. The shared files have none left and are out of the #848 baseline. test_happy_eyeballs (characterization, same PR) passed before and after, on Tier 2 Linux and in the ci-full Windows/macOS builds.
Found along the way and fixed: #903 (a failed lookup reported errno, i.e. 0 on Linux), via #918. Nothing left on this item.
Activity
zackees commentedon Oct 15, 2026
Claiming: shared/happy-eyeballs facade.
Plan (one PR, RED then GREEN):
test_happy_eyeballs(cmocka, Tier 2), loopback connect to a local listener over IPv4 and IPv6, a refused port, and an unresolvable host. It must pass before and after the move.happy-eyeballs-sock.hthat dispatches to -windows.h/-posix.h, but that dispatcher would itself be an#ifdefin a shared file, which ci: ratchet lint for platform conditionals in shared C/C++ (#847 step 1) #848's policy bans. Instead CMake picks the platform half: shared code includeshe-platform.hand callshe_platform_*();platform/windows/andplatform/posix/each holdhe-platform.h+he-platform.c, andshared/happy-eyeballs/CMakeLists.txtadds the right directory and source per OS.happy-eyeballs.h's socket-type include moves the same way. Shared files end with zero platform conditionals.ci-fulllabel so the Windows and macOS builds run.@zackees (#848): will
*/platform/windows/and*/platform/posix/be in the blessed-directory allowlist, or do you want-windows/-nixfile names instead? I'll follow whichever #848 lands with.zackees commentedon Oct 15, 2026
Naming answered by #900 (the merged #848 ratchet): a path is blessed when any of its tokens is a platform word, and
windowsandposixare both inPLATFORM_TOKENS, soshared/happy-eyeballs/platform/windows/andplatform/posix/work as planned. Baseline today:happy-eyeballs.c7,happy-eyeballs.h1; the move takes both to 0 and drops them fromci/platform-ifdef-baseline.json. Starting the move on #910 once #918 (#903) merges, so the moved code carries that fix.test: Characterize shared/happy-eyeballs before moving its platform code
happy-eyeballs: Move the Winsock/BSD-socket code into platform/<os>/
test: Characterize shared/happy-eyeballs before moving its platform code
happy-eyeballs: Move the Winsock/BSD-socket code into platform/<os>/
zackees commentedon Oct 16, 2026
Done: #910 moved the 8 platform conditionals in
shared/happy-eyeballsintoplatform/windows/andplatform/posix/(happy-eyeballs-socket.hfor the public header's socket types,happy-eyeballs-platform.hfor the rest), with CMake picking the directory. The shared files have none left and are out of the #848 baseline.test_happy_eyeballs(characterization, same PR) passed before and after, on Tier 2 Linux and in theci-fullWindows/macOS builds.Found along the way and fixed: #903 (a failed lookup reported
errno, i.e. 0 on Linux), via #918. Nothing left on this item.happy-eyeballs: Move platform code behind per-platform files (obs-rus…