Repository navigation
feat: add HTTP/1.1 connection reuse - #20
Conversation
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 9bd26b0cdd
ℹ️ 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".
| configure_test_timeouts(client); | ||
|
|
||
| auto first = client.get(make_url(server.port, "/first")); | ||
| ASSERT_TRUE(first); |
There was a problem hiding this comment.
Ensure the worker is joined before a fatal assertion
If the initial request fails—for example because of a loopback or transport regression—ASSERT_TRUE(first) returns from the test while worker is still joinable. Destroying that std::thread invokes std::terminate, aborting the entire test executable instead of reporting this test failure and continuing; use RAII joining or a nonfatal check with an explicit cleanup path.
Useful? React with 👍 / 👎.
Summary
Implements the v0.6 roadmap milestone: single-slot HTTP/1.1 connection reuse for the stateful
Client.Behavior
ClientConnection: closeConnection: closeOwnership design
The public
Clientremains no-PImpl. Reusable connection state is stored inline as an opaquestd::uintptr_tsocket token plus owned host/port identity; native Winsock/POSIX socket types remain internal. During request execution the token is adopted back into the existing RAIITcpConnection, and an eligible live handle is released back into the Client slot only after the response is complete.Clientis now explicitly move-only, matching its resource-owning semantics.Stale keep-alive policy
This PR does not add automatic retries. If a peer has closed an apparently reusable connection, the next request may fail with the normal transport/protocol error; that stale slot is discarded, and the following request reconnects normally. This avoids silently replaying non-idempotent requests and keeps automatic retry policy outside v1 scope.
Tests
Adds dedicated loopback integration coverage for:
Connection: closeforcing a reconnectAll tests are local-only and use bounded accept/read waits to avoid hanging CI.