Skip to content

Add a channel number lookup and an active-channel check - #592

Open
rg0now wants to merge 1 commit into
pion:mainfrom
l7mp:client-find-channel-by-addr
Open

Add a channel number lookup and an active-channel check#592
rg0now wants to merge 1 commit into
pion:mainfrom
l7mp:client-find-channel-by-addr

Conversation

@rg0now

@rg0now rg0now commented Aug 24, 2026

Copy link
Copy Markdown
Contributor

This PR proposes a simpler alternative to the PrepareUDPPeer client API proposed in #585.

Description

PR #585 adds PrepareUDPPeer(ctx, peer) so an application can block until a peer has a confirmed permission and bound a channel before sending (this is useful for QUIC senders). This PR exposes the channel state instead of managing it, which allows a caller to poll the channel's active state to know when the channel comes online (and when it goes away).

Added is a new IsChannelActive(chNum uint16) bool client API that reports the same condition WriteTo uses to choose ChannelData over a SendIndication. The PR also adds FindChannelNumberByAddr, the counterpart to the existing FindAddrByChannelNumber, so a caller holding a peer address can learn the channel number. Tests now cover all three accessors across every binding state.

Reference

#585

@rg0now
rg0now requested a review from JoTurk August 24, 2026 16:31
@codecov

codecov Bot commented Aug 24, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 82.64%. Comparing base (874faf9) to head (71d0333).

Additional details and impacted files
@@            Coverage Diff             @@
##             main     #592      +/-   ##
==========================================
+ Coverage   82.42%   82.64%   +0.22%     
==========================================
  Files          46       46              
  Lines        3305     3313       +8     
==========================================
+ Hits         2724     2738      +14     
+ Misses        377      374       -3     
+ Partials      204      201       -3     
Flag Coverage Δ
go 82.64% <100.00%> (+0.22%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

UDPConn maps a channel number back to its peer address, but not the
other way round. The new FindChannelNumberByAddr accessor adds the
missing direction with the semantics of its counterpart: it resolves
a binding whether or not the server has confirmed it. To check
whether a channel is established, a separate IsChannelActive(chan-id)
reports whether the client uses a chan-id for writing. Also add
tests cover all channel accessors.
@rg0now
rg0now force-pushed the client-find-channel-by-addr branch from 6e1a473 to 71d0333 Compare August 24, 2026 16:35
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.

1 participant