Skip to content

fix(p2p): unify TCP/QUIC transport building - #694

Open
varex83agent wants to merge 1 commit into
mainfrom
fix/issue-621-unify-transport-building
Open

fix(p2p): unify TCP/QUIC transport building#694
varex83agent wants to merge 1 commit into
mainfrom
fix/issue-621-unify-transport-building

Conversation

@varex83agent

Copy link
Copy Markdown
Collaborator

Closes #621.

Collapses the four near-identical swarm builders into a single base_transport parameterized by NodeType, so transport and address selection are made in one place — Charon's shape in p2p/p2p.go. TCP is always installed; QUIC is chained onto it only for NodeType::QUIC.

This fixes a NodeType::QUIC server running QuicUpgradeBehaviour with quic_enabled = false while installing both transports regardless of node type, and lets the relay server pass NodeType::QUIC (as Charon's relay does) instead of NodeType::TCP plus a manual UDP listen_on workaround. The six copy-paste _tcp_/_udp_ helper pairs across p2p/src/config.rs, p2p/src/utils.rs and relay-server/src/utils.rs are folded into single functions taking a TransportProtocol.

Co-Authored-By: Bohdan Ohorodnii 35969035+varex83@users.noreply.github.com

Collapse the four near-identical swarm builders into one transport
builder parameterized by `NodeType`, so transport and address selection
are made together as Charon does in `p2p.go`.

This fixes a `NodeType::QUIC` server running `QuicUpgradeBehaviour` with
`quic_enabled = false` and installing both transports regardless of node
type, and lets the relay server pass `NodeType::QUIC` (as Charon's relay
does) instead of `NodeType::TCP` plus a manual UDP `listen_on` loop.

Folds the six copy-paste `_tcp_`/`_udp_` helper pairs into single
functions taking a `TransportProtocol`.

Closes #621.

Co-Authored-By: Bohdan Ohorodnii <35969035+varex83@users.noreply.github.com>
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.

Unify TCP/QUIC transport building

2 participants