Skip to content

Share broker TCP namespace - #1167

Merged
Weidong Cui (wdcui) merged 14 commits into
uliteboxfrom
wdcui/ulitebox/broker-tcp-namespace
Aug 15, 2026
Merged

Share broker TCP namespace#1167
Weidong Cui (wdcui) merged 14 commits into
uliteboxfrom
wdcui/ulitebox/broker-tcp-namespace

Conversation

@wdcui

@wdcui Weidong Cui (wdcui) commented Aug 13, 2026

Copy link
Copy Markdown
Member

This PR gives all broker sessions one shared guest TCP namespace by moving guest TCP port reservation and ephemeral allocation into broker core and routing guest-to-guest connections through private Linux endpoints with guest-visible accept translation. It adds platform-owned TCP lifecycle tracking, bounded pending and stale-connection state, retained connector accounting, backlog-drain safeguards, and blocking-accept readiness coverage, and updates the Linux runner TCP server integration to use the shared namespace.

Weidong Cui (wdcui) and others added 13 commits August 14, 2026 18:39
Give all broker sessions one guest TCP port namespace, route guest connections through private Linux endpoints, and translate accepted peers back to guest addresses. Bound pending connection and retained connector state across socket and session teardown.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>

Copilot-Session: b5a1a347-37a8-4246-8bbc-306590921475
Retire platform authority while the guest-port reservation is still held when bind echoes an untrusted address, then leave the core socket terminal.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>

Copilot-Session: b5a1a347-37a8-4246-8bbc-306590921475
Give descriptor-free discard markers a bounded lifetime after session teardown so abandoned listeners cannot permanently consume the broker-wide pending-connection budget.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>

Copilot-Session: b5a1a347-37a8-4246-8bbc-306590921475
Rename mixed Linux socket state to make its reactor ownership explicit while leaving the portable namespace redesign for a focused follow-up.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>

Copilot-Session: b5a1a347-37a8-4246-8bbc-306590921475
Keep allocation, validation, and insertion in one operation and derive the binding key from its guest address.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>

Copilot-Session: b5a1a347-37a8-4246-8bbc-306590921475
Document why pending connection metadata is bounded independently from live and retained socket descriptors.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>

Copilot-Session: b5a1a347-37a8-4246-8bbc-306590921475
Name reactor-wide and per-session retained connector counts explicitly as counters.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>

Copilot-Session: b5a1a347-37a8-4246-8bbc-306590921475
Name the live socket and pending guest connection fields explicitly as per-session counters.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>

Copilot-Session: b5a1a347-37a8-4246-8bbc-306590921475
Release abortively closed connector descriptors immediately while retaining deadline-bound fail-closed metadata. Limit unmatched accepts per command so private-endpoint traffic cannot monopolize the reactor, and preserve edge-triggered readiness for retry.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>

Copilot-Session: b5a1a347-37a8-4246-8bbc-306590921475
Synchronously retire platform authority for indeterminate or invalid TCP connect results, make duplicate guest-port reservation attachment fail closed, and document bind and accepted-peer platform contracts.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>

Copilot-Session: b5a1a347-37a8-4246-8bbc-306590921475
Reject ambiguous native tuple reuse, gate routes until stale listener backlogs are drained, and preserve listener cleanup after partial shutdown failures. Exclude the unsupported published-server benchmark until TCP publication lands.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Copilot-Session: b5a1a347-37a8-4246-8bbc-306590921475
Force readiness republication when unmatched accepts yield so edge-triggered listeners continue making progress. Keep StopListening core and platform state consistent when terminal readiness publication fails.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Copilot-Session: b5a1a347-37a8-4246-8bbc-306590921475
Track Linux native connection transitions explicitly so teardown no longer infers lifecycle with getpeername. Preserve late accept identity with bounded keyed and tuple-unknown discard protection while retaining ordinary close semantics after accept.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>

Copilot-Session: b5a1a347-37a8-4246-8bbc-306590921475
@wdcui
Weidong Cui (wdcui) force-pushed the wdcui/ulitebox/broker-tcp-namespace branch from cd5f7f7 to e4e2ee1 Compare August 15, 2026 01:40
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>

Copilot-Session: b5a1a347-37a8-4246-8bbc-306590921475
@github-actions

Copy link
Copy Markdown

🤖 SemverChecks 🤖 ⚠️ Potential breaking API changes detected ⚠️

Click for details
--- failure struct_pub_field_missing: pub struct's pub field removed or renamed ---

Description:
A publicly-visible struct has at least one public field that is no longer available under its prior name. It may have been renamed or removed entirely.
        ref: https://doc.rust-lang.org/cargo/reference/semver.html#item-remove
       impl: https://github.com/obi1kenobi/cargo-semver-checks/tree/v0.50.0/src/lints/struct_pub_field_missing.ron

Failed in:
  field local_address of struct AcceptedPlatformSocket, previously in file /home/runner/work/litebox/litebox/target/semver-checks/git-ulitebox/198d7bd7c8de65efe55d8c397492a3d2e7d4623f/litebox_broker_core/src/socket.rs:31

--- failure method_parameter_count_changed: pub method parameter count changed ---

Description:
A publicly-visible method now takes a different number of parameters, not counting the receiver (self) parameter.
        ref: https://doc.rust-lang.org/cargo/reference/semver.html#fn-change-arity
       impl: https://github.com/obi1kenobi/cargo-semver-checks/tree/v0.50.0/src/lints/method_parameter_count_changed.ron

Failed in:
  litebox_broker_platform_linux_userland::LinuxSocketProvider::new takes 1 parameters in /home/runner/work/litebox/litebox/target/semver-checks/git-ulitebox/198d7bd7c8de65efe55d8c397492a3d2e7d4623f/litebox_broker_platform_linux_userland/src/socket.rs:157, but now takes 2 parameters in /home/runner/work/litebox/litebox/litebox_broker_platform_linux_userland/src/socket.rs:159

@wdcui
Weidong Cui (wdcui) added this pull request to the merge queue Aug 15, 2026
Merged via the queue into ulitebox with commit 3599f72 Aug 15, 2026
7 checks passed
@wdcui
Weidong Cui (wdcui) deleted the wdcui/ulitebox/broker-tcp-namespace branch August 15, 2026 03:23
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant