Conversation
- Move expire timeout code from multi into splay.c - keep a "time_base" timestamp to calculate timediff_t for actual timeout values. Unfortunately this means our timeouts will go wrong after ~500,000 years of continuous operations... - use timediff_t as key in splay instead of curltime - use timediff_t in transfers expire times instead of curltime - re-comment splay.c for better understanding how it works - replace splay nodes double-linked "same" list with a single link, we almost never have duplicate keys - keep transfer `mid` in splay nodes instead of the transfer pointer - keep registered bit in splay node for tracking instead of separate bit in transfer - adapt unit1309.c to changes in timediff_t and mid
There was a problem hiding this comment.
Pull request overview
Refactors multi-handle timeout management around base-relative microsecond offsets and simplifies splay-tree nodes.
Changes:
- Moves timeout-tree operations into
splay.c. - Replaces timestamp keys and easy pointers with offsets and transfer IDs.
- Updates timeout callers, tracing, tests, and size limits.
Reviewed changes
Copilot reviewed 18 out of 18 changed files in this pull request and generated 4 comments.
Show a summary per file
| File | Description |
|---|---|
tests/unit/unit3214.c |
Updates multi-handle size limit. |
tests/unit/unit1309.c |
Adapts splay tests to the new API. |
tests/data/test1309 |
Updates expected test output. |
lib/vdns/asyn-thrdd.c |
Uses renamed timer-clearing API. |
lib/urldata.h |
Stores relative timeout offsets. |
lib/url.c |
Clears all timers during cleanup. |
lib/splay.h |
Defines timeout and revised splay APIs. |
lib/splay.c |
Implements timeout management and simplified splay nodes. |
lib/multiif.h |
Revises expiration APIs. |
lib/multihandle.h |
Embeds timeout state in multi handles. |
lib/multi.c |
Integrates relative timeout handling. |
lib/http.c |
Uses renamed timer-clearing API. |
lib/curlx/timeval.h |
Declares microsecond conversion helper. |
lib/curlx/timeval.c |
Implements conversion helper. |
lib/curl_trc.c |
Traces relative expiration offsets. |
lib/cshutdn.c |
Uses consolidated expiration API. |
lib/connect.c |
Uses consolidated expiration API. |
lib/cf-ip-happy.c |
Uses renamed timer-clearing API. |
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
- fix us_to_ms ceil to handle negative values - update SPLAY documentation - fix comment - add test cases
bagder
approved these changes
Aug 14, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
midin splay nodes instead of the transfer pointer