Deduplicate the wait-for-socket macros and the stats-refresh loop tick#484
Merged
Conversation
URLSAVENAME_WAIT_FOR_AVAILABLE_SOCKET (htsname.c) and WAIT_FOR_AVAILABLE_SOCKET (htsparse.h) were byte-for-byte duplicates, both carrying the #481 checkmirror break. Replace them with a single hts_wait_available_socket() in htscore.c; the callback-abort path still returns -1 from the callers. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com> Signed-off-by: Xavier Roche <roche@httrack.com>
The wait-for-socket macro body (stats refresh + loop callback) also existed open-coded at six more sites across htsname.c and htsparse.c, differing only in the slot index passed to the callback and the abort action. Collapse all of them onto a shared hts_loop_tick(); each caller keeps its own abort path. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com> Signed-off-by: Xavier Roche <roche@httrack.com>
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.
Follow-up to #482, which had to patch the same -E checkmirror break into two byte-for-byte copies of the wait-for-socket macro (
URLSAVENAME_WAIT_FOR_AVAILABLE_SOCKETin htsname.c,WAIT_FOR_AVAILABLE_SOCKETin htsparse.h). The first commit folds them into a singlehts_wait_available_socket().The core of the macro body, refreshing the transfer stats and running the loop callback, also existed open-coded at six more sites in htsname.c and htsparse.c, differing only in the slot index passed to the callback and the abort action. The second commit collapses them onto a shared
hts_loop_tick(); each caller keeps its own abort path. No behavior change, net -100 lines, and make check stays green.