feat: add timed TCP connection establishment - #9
Conversation
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: f0faafd374
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| if (wait_result < 0) { | ||
| return {ConnectStatus::Failed, errno}; |
There was a problem hiding this comment.
Retry poll when a signal interrupts the wait
On POSIX, if a signal is delivered while a connection attempt is pending, poll() returns -1 with errno == EINTR; this path reports ConnectFailed and abandons a potentially viable endpoint well before the configured deadline. Retry the wait after recomputing the remaining timeout when the error is EINTR, while preserving other errors as failures.
Useful? React with 👍 / 👎.
Summary
Adds the v1 TCP connection-establishment layer on top of the merged resolver and native-socket primitives.
Added
src/platform/socket_connect.hpp/.cppselect()/ POSIXpoll()wait pathSO_ERRORverification after readinesssrc/net/tcp_connection.hpp/.cppTcpConnectionSocketCreateFailed,ConnectFailed, andConnectTimeoutmappingNativeSockettests/tcp_connection_test.cppBuild changes
Timeout semantics
The configured connect timeout is a budget for the complete connection operation, not a fresh timeout for every resolved address. IPv6/IPv4 candidate fallback therefore remains bounded by the caller's requested timeout.
CI / determinism
Connection tests use a local ephemeral loopback listener only. They do not require public internet or external services.
Scope
This PR intentionally does not add request writes, response reads, partial-I/O loops, read/write timeouts, HTTP serialization, or connection reuse policy. Those build on this established connection primitive in follow-up PRs.