connection close tweaks - #22379
Closed
icing wants to merge 2 commits into
Closed
Conversation
icing
commented
Jul 23, 2026
Contributor
- connclose/streamclose/connkeep() remove description string that was never used anywhere. Add trace statements where reasons for closing were not already traced and maybe not obvious.
- multi_remove_handle: only lookup former connection in pool when transfer is set to connect only
- test1554: adapt expectations now that pool is less often locked
bagder
approved these changes
Jul 23, 2026
There was a problem hiding this comment.
Pull request overview
This PR refactors curl’s internal connection/stream close/keep signaling by removing the (previously unused) “reason” string plumbing from connclose/streamclose/connkeep() and adding targeted trace output where close decisions might otherwise be unclear. It also adjusts multi-handle removal behavior for CONNECT_ONLY transfers and updates a debug test expectation to match reduced pool-lock activity.
Changes:
- Simplify connection control APIs: replace
connclose(conn, "reason")/streamclose(conn, "reason")/connkeep(conn, "reason")with single-argument macros and a simplifiedCurl_conncontrol()signature. - Tweak multi removal and pending scheduling: rename
process_pending_handles()→multi_schedule_pending()and adjustCurl_multi_remove_handle()logic aroundCONNECT_ONLY. - Update test1554 expectations due to less frequent CONNECT pool locking.
Reviewed changes
Copilot reviewed 26 out of 26 changed files in this pull request and generated 3 comments.
Show a summary per file
| File | Description |
|---|---|
| tests/data/test1554 | Updates expected CONNECT lock/unlock trace output to match reduced locking. |
| lib/vssh/libssh2.c | Drops unused connclose reason string usage for SSH session cleanup. |
| lib/vssh/libssh.c | Drops unused connclose reason string usage for SSH session cleanup. |
| lib/vquic/cf-quiche.c | Removes connclose reason string for HTTP/3 refused-stream retry path. |
| lib/vquic/cf-ngtcp2.c | Removes connclose reason string for HTTP/3 refused-stream retry path. |
| lib/vquic/cf-ngtcp2-proxy.c | Removes connclose reason string for HTTP/3 refused-stream retry path. |
| lib/transfer.c | Removes connclose reason string on retry path. |
| lib/tftp.c | Removes connclose reason string for TFTP non-reuse policy. |
| lib/smtp.c | Adds trace before marking connection close on error; removes reason string. |
| lib/smb.c | Adds trace before marking connection close on SMB errors; removes reason strings. |
| lib/sendf.c | Removes stream/conn close reason strings in write-path error handling. |
| lib/pop3.c | Adds trace before marking connection close on error; removes reason string. |
| lib/multi.c | Renames pending scheduler function and adjusts connect-only removal handling; removes reason strings. |
| lib/mqtt.c | Removes connclose reason string on TLS connection failure path. |
| lib/ldap.c | Removes connclose reason string for LDAP always-non-reuse behavior. |
| lib/imap.c | Adds trace before marking connection close on error; removes reason string. |
| lib/http2.c | Adds/adjusts trace around close decisions; removes connclose reason strings. |
| lib/http.c | Removes reason strings from keep/close calls; adds trace in one close case. |
| lib/gopher.c | Removes connclose reason string on TLS connection failure path. |
| lib/ftp.c | Refactors helper signature and adds trace in error-close path; removes reason strings. |
| lib/easy.c | Simplifies connect-only cleanup by terminating the detached connection directly. |
| lib/connect.h | Renames control constants and collapses macros to single-argument forms; updates Curl_conncontrol signature. |
| lib/connect.c | Updates Curl_getconnectinfo() behavior and implements simplified Curl_conncontrol(). |
| lib/conncache.h | Removes Curl_cpool_do_by_id() declaration (no longer used). |
| lib/conncache.c | Removes Curl_cpool_do_by_id() implementation (no longer used). |
| lib/cfilters.c | Makes Curl_conn_is_multiplex() null-safe and simplifies iteration. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
- connclose/streamclose/connkeep() remove description string that was never used anywhere. Add trace statements where reasons for closing were not already traced and maybe not obvious. - multi_remove_handle: only lookup former connection in pool when transfer is set to connect only - test1554: adapt expectations now that pool is less often locked
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.