Skip to content

Conversation

rklaehn
Copy link
Collaborator

@rklaehn rklaehn commented Aug 26, 2025

Description

Let the per-connection actor watch for connection close. When the connection is closed the conn actor will tell the main actor to remove the per-conn actor, and the next connection attempt will get a new per-connection actor.

Also add an optional callback to wait for a connection to reach a certain state before handing it to the user. Implements #141

Breaking Changes

util::connection_pool::Config is no longer Copy
util::connection_pool::Config has a new field on_connected
util::connection_pool::PoolConnectError has a new variant OnConnectError

Notes & open questions

Note: there is a very low probability that a request to get a ConnectionRef will return the closed connection. But that is fine. If the connection is closed, all currently live ConnectionRefs will turn unusable anyway, what's one more? In connected state the actor will be very fast in handing out ConnectionRef, so the queue should never be full. The queue is mostly for waiting during connect.

Change checklist

  • Self-review.
  • Documentation updates following the style guide, if relevant.
  • Tests if relevant.
  • All breaking changes documented.

Copy link

github-actions bot commented Aug 26, 2025

Documentation for this PR has been generated and is available at: https://n0-computer.github.io/iroh-blobs/pr/140/docs/iroh_blobs/

Last updated: 2025-08-28T07:54:44Z

@n0bot n0bot bot added this to iroh Aug 26, 2025
@github-project-automation github-project-automation bot moved this to 🏗 In progress in iroh Aug 26, 2025
@rklaehn rklaehn marked this pull request as ready for review August 27, 2025 10:51
@rklaehn rklaehn requested a review from matheus23 August 27, 2025 10:54
rklaehn and others added 2 commits August 28, 2025 09:49
Co-authored-by: Philipp Krüger <philipp.krueger1@gmail.com>
@rklaehn rklaehn merged commit b1880e1 into main Aug 28, 2025
23 of 24 checks passed
@github-project-automation github-project-automation bot moved this from 🏗 In progress to ✅ Done in iroh Aug 28, 2025
@rklaehn rklaehn deleted the watch-close branch August 28, 2025 09:02
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Status: ✅ Done
Development

Successfully merging this pull request may close these issues.

3 participants