Skip to content

connection close tweaks - #22379

Closed
icing wants to merge 2 commits into
curl:masterfrom
icing:conn-close-tweaks
Closed

connection close tweaks#22379
icing wants to merge 2 commits into
curl:masterfrom
icing:conn-close-tweaks

Conversation

@icing

@icing icing commented Jul 23, 2026

Copy link
Copy Markdown
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

@github-actions github-actions Bot added the tests label Jul 23, 2026
@icing
icing force-pushed the conn-close-tweaks branch from 8c16985 to 26287a5 Compare July 23, 2026 12:20
@icing
icing requested a review from bagder July 23, 2026 14:40

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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 simplified Curl_conncontrol() signature.
  • Tweak multi removal and pending scheduling: rename process_pending_handles()multi_schedule_pending() and adjust Curl_multi_remove_handle() logic around CONNECT_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.

Comment thread lib/connect.h Outdated
Comment thread lib/connect.c Outdated
Comment thread lib/multi.c
icing added 2 commits July 24, 2026 10:30
- 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
@icing
icing force-pushed the conn-close-tweaks branch from 26287a5 to 7fedca7 Compare July 24, 2026 08:40
@icing
icing requested a review from bagder July 24, 2026 09:35
@bagder bagder closed this in e093c67 Jul 24, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Development

Successfully merging this pull request may close these issues.

3 participants