Skip to content

Track peer address in UDP bind registration#7

Merged
vnt-dev merged 1 commit into
rustp2p:mainfrom
lanthora:udp-bind-per-peer
Jul 10, 2026
Merged

Track peer address in UDP bind registration#7
vnt-dev merged 1 commit into
rustp2p:mainfrom
lanthora:udp-bind-per-peer

Conversation

@lanthora

@lanthora lanthora commented Jul 9, 2026

Copy link
Copy Markdown
Contributor

Include the peer address in the bind-address key so multiple UDP sockets can bind to the same local address with distinct peers. Add BindAddr::set_peer to update the registration when a socket's peer is established via connect or bind0.

@lanthora
lanthora force-pushed the udp-bind-per-peer branch from d38bba7 to 36d67f4 Compare July 9, 2026 11:31
Extend the bind_addrs HashSet key from (protocol, local) to
(protocol, local, Option<peer>) via a new BindKey type alias, and
add a matching peer field to BindAddr.

- add_bind_addr / remove_bind_addr take a peer: Option<SocketAddr>.
- IpStack::bind takes a peer argument; bind_ip passes None.
- BindAddr gains set_peer to re-key an entry with a new peer.
- UdpSocket::bind0 forwards peer_addr; connect calls set_peer.
- TcpListener/TcpStream bind calls pass None.
@lanthora
lanthora force-pushed the udp-bind-per-peer branch from 36d67f4 to d9764e3 Compare July 9, 2026 12:10
@vnt-dev
vnt-dev merged commit 1711ed0 into rustp2p:main Jul 10, 2026
1 check passed
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.

2 participants