Repository navigation
happy-eyeballs: Move platform code behind per-platform files - #910
Conversation
8705d68 to
91c141b
Compare
|
Pushed the facade move ( |
C only: test_happy_eyeballs connects over IPv4 (and IPv6 where ::1 resolves) to a loopback listener and checks the server accepts it, pins get_remote_addr returning the address length, a refused port, an unresolvable host and the invalid-argument checks. It must pass unchanged before and after the facade move (#880). The resolve-failure error code is left unpinned: it is errno, usually 0 on Linux (#903). Refs #880
The 8 platform conditionals in happy-eyeballs.c and happy-eyeballs.h move into platform/windows/ and platform/posix/, each with happy-eyeballs-socket.h (socket types for the public header) and happy-eyeballs-platform.h (GetSockError, snprintf, SHUT_RDWR, closesocket, and static inline he_platform_dns_blocked (the COMODO probe), he_platform_socket (WSASocket vs socket) and he_platform_socket_nosigpipe). CMake puts the right directory on the include path, so the shared files have no platform conditionals; the test_happy_eyeballs passes before and after. Refs #880
91c141b to
3a9b49b
Compare
|
Rebased onto master after #918 merged: replaced head |
Refs #880 (part of #847).
Step 1 (this commit): characterization test
test/cmocka/test_happy_eyeballs.c, C only, registered viatests.d/(built whereOBS::happy-eyeballsexists,ws2_32on Windows):connect/timedwaitreturn 0, the error code is 0, the server accepts the connection, andhappy_eyeballs_get_remote_addrreturns the address length (not a status);::1does not resolve (AI_ADDRCONFIGdrops it on hosts without a non-loopback IPv6 address, as in the Tier 2 container);.invalidhost fails (its error code is not pinned: it iserrno, usually 0 on Linux, filed as bug: shared/happy-eyeballs: a failed name lookup reports errno instead of the getaddrinfo error (error code 0 on Linux) #903);connectrejects NULL host, port 0 and NULL context.Local:
rust/tools/linux-validate/run.sh --repeat 5 --tests test_happy_eyeballs: 250/250 OFF and ON, 5 repeats each;./lintok.Step 2: the move (
happy-eyeballs: Move the Winsock/BSD-socket code into platform/<os>/): the 8 platform conditionals inhappy-eyeballs.c/.hmove intoplatform/windows/andplatform/posix/(both blessed by #900'sPLATFORM_TOKENS), each with:happy-eyeballs-socket.h: socket types for the public header (SOCKETon POSIX);happy-eyeballs-platform.h:GetSockError,GetAddrInfoErrorString(from happy-eyeballs: Report the getaddrinfo error for a failed lookup #918),snprintf/SHUT_RDWR/closesocket, and static inlinehe_platform_dns_blocked(the COMODO probe),he_platform_socket(WSASocketvssocket) andhe_platform_socket_nosigpipe.CMake puts the right directory on the include path (
$<PLATFORM_ID:Windows>), and lists the headers with absolute paths: relative paths inside generator expressions are not converted (CMP0076), which broke consumers' configure on a first push. The shared files have no platform conditionals left (the__cplusplusandINVALID_SOCKETones are not platform macros);ci/platform-ifdef-baseline.jsondrops both files.Local:
ci/platform_ifdef_ratchet.pyok; POSIXcc -fsyntax-only -std=gnu11 -Wall -Werrorok;./lintok; Tier 2run.sh --repeat 3 --tests 'test_happy_eyeballs|test_rtmp_dbr_user_bitrate': 251/251 OFF and ON (both happy-eyeballs tests and the RTMP test that links it, 3 repeats each).ci-fullis set so the Windows and macOS builds compile the moved code.