Skip to content

feat(iroh): expose incoming connection limits on Endpoint::Builder - #4546

Open
random-ml wants to merge 1 commit into
n0-computer:mainfrom
random-ml:configure-incoming-limits
Open

random-ml wants to merge 1 commit into
n0-computer:mainfrom
random-ml:configure-incoming-limits

Conversation

@random-ml

Copy link
Copy Markdown

Description

Adds endpoint-wide configuration for the number and buffered size of pending incoming connection attempts.

  • Adds max_incoming, incoming_buffer_size, and incoming_buffer_size_total to Endpoint::Builder.
  • Stores only explicit overrides, preserving the existing noq defaults when the methods are not called.
  • Applies the overrides whenever the endpoint creates its default server configuration, including after Endpoint::set_alpns().
  • Clarifies that the similarly named ServerConfigBuilder settings cannot affect an Incoming that already exists.
  • Adds coverage for zero and nonzero pending-attempt limits, recovery after capacity is released, and application of all three overrides.

Closes #4545

API Changes

This adds three non-breaking fluent builder methods:

Endpoint::builder(presets::Minimal)
    .max_incoming(16)
    .incoming_buffer_size(64 * 1024)
    .incoming_buffer_size_total(256 * 1024);

The methods mirror the existing settings on ServerConfigBuilder, using the non-set_ naming convention already used by Endpoint::Builder. Existing behavior and defaults are unchanged.

Notes & open questions

The implementation stores optional overrides rather than duplicating noq's default values, so future default changes continue to flow through when applications do not configure these limits.

Testing

  • cargo test --locked -p iroh --lib — 125 passed, 1 ignored.
  • cargo test --locked -p iroh --all-features --lib — 131 passed, 1 ignored.
  • cargo fmt --all --check -- --config unstable_features=true --config imports_granularity=Crate,group_imports=StdExternalCrate,reorder_imports=true,format_code_in_doc_comments=true.
  • RUSTFLAGS=-Dwarnings cargo clippy --locked --workspace --all-features --all-targets --lib --bins --tests --benches --examples.
  • RUSTFLAGS=-Dwarnings cargo clippy --locked --workspace --no-default-features --all-targets --lib --bins --tests --benches --examples.
  • RUSTFLAGS=-Dwarnings cargo clippy --locked --workspace --all-targets --lib --bins --tests --benches --examples.
  • RUSTDOCFLAGS=-Dwarnings cargo doc --locked --workspace --all-features --no-deps --document-private-items.
  • git diff --check.

Change checklist

  • Self-review.
  • Documentation updates following the style guide, if relevant.
  • Tests if relevant.
  • All API changes documented.
  • This PR was created by a human that thought critically about the
    proposed change and wrote an as clear and concise description as
    they could.
  • This PR isn't slop, and is carefully crafted to do have the
    intented effect.

@n0bot n0bot Bot added this to iroh Sep 22, 2026
@github-project-automation github-project-automation Bot moved this to 🚑 Needs Triage in iroh Sep 22, 2026
@random-ml
random-ml marked this pull request as ready for review September 23, 2026 09:15

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: 🚑 Needs Triage

Development

Successfully merging this pull request may close these issues.

Expose incoming connection limits on Endpoint::Builder

1 participant