Skip to content

conn upkeep/alive: move and enhance - #21806

Closed
icing wants to merge 1 commit into
curl:masterfrom
icing:conn-upkeep-alives
Closed

conn upkeep/alive: move and enhance#21806
icing wants to merge 1 commit into
curl:masterfrom
icing:conn-upkeep-alives

Conversation

@icing

@icing icing commented May 29, 2026

Copy link
Copy Markdown
Contributor
  • move Curl_conn_seems_dead() into conncache.c
  • move Curl_conn_upkeep() into conncache.c
  • when upkeep gives an error on a connection not in use, terminate it

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 connection “dead/alive” detection and connection upkeep so the logic lives with the connection pool (conncache), and adds behavior to terminate unused connections when upkeep fails.

Changes:

  • Move “connection seems dead” logic from url.c into conncache.c as Curl_cpool_conn_seems_dead(), and update call sites.
  • Inline/move connection upkeep logic into conncache.c and terminate non-in-use connections when upkeep returns an error.
  • Simplify Curl_conn_keep_alive() to upkeep all sockets of a connection (removes sockindex parameter).

Reviewed changes

Copilot reviewed 6 out of 6 changed files in this pull request and generated 3 comments.

Show a summary per file
File Description
lib/url.h Removes prototypes for functions moved out of url layer.
lib/url.c Switches dead-connection checks to the new cpool helper.
lib/conncache.h Declares the new Curl_cpool_conn_seems_dead() API.
lib/conncache.c Implements dead-check in conncache and enhances upkeep to terminate failed idle conns.
lib/cfilters.h Updates Curl_conn_keep_alive() signature (drops sockindex).
lib/cfilters.c Implements new Curl_conn_keep_alive() behavior over both sockets.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread lib/cfilters.h
Comment thread lib/cfilters.c Outdated
Comment thread lib/conncache.c
@icing
icing force-pushed the conn-upkeep-alives branch from cfc0d11 to 381583c Compare June 2, 2026 07:01
@bagder

bagder commented Jun 14, 2026

Copy link
Copy Markdown
Member

@icing this has a conflict now!

@icing
icing force-pushed the conn-upkeep-alives branch from 90b936f to cc24176 Compare June 26, 2026 12:52
@icing

icing commented Jun 26, 2026

Copy link
Copy Markdown
Contributor Author

Rebased on current master.

@icing
icing requested a review from bagder June 26, 2026 13:06
@bagder

bagder commented Jul 24, 2026

Copy link
Copy Markdown
Member

@icing this old one is now out of sync again, should we get this one merged?

@icing
icing force-pushed the conn-upkeep-alives branch from cc24176 to 2fce1a9 Compare July 27, 2026 07:49
- move `Curl_conn_seems_dead()` into conncache.c
- move `Curl_conn_upkeep()` into conncache.c
- when upkeep gives an error on a connection not in use,
  terminate it
@icing
icing force-pushed the conn-upkeep-alives branch from 2fce1a9 to ceb1cff Compare July 27, 2026 09:17
@bagder bagder closed this in c9ead9b Jul 27, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

3 participants