Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(dcutr): update the DCUtR initiator transport direction to Inbound #994

Merged
merged 5 commits into from
Nov 29, 2023

Conversation

diegomrsantos
Copy link
Collaborator

@diegomrsantos diegomrsantos commented Nov 27, 2023

During DCUtR, the listener initiates the direct connection (it is called the DCUtR client) attempt and must connect to the other peer as the incoming upgrade direction. Yamux must use this direction to decide on using odd or even stream IDs, not the initial underlying connection direction or socket "direction". It means we need to change the underlying TCP connection direction to Inbound, despite it being a dial.

This is an unusual case where a peer initiates a connection, but should treat it as incoming. The reason is probably that DCUtR happens when the other remote peer dials a peer's relayed address, therefore the original connection was in fact incoming.

Related:
https://github.com/libp2p/specs/tree/master/yamux
https://github.com/libp2p/specs/blob/master/relay/DCUtR.md

Copy link

codecov bot commented Nov 28, 2023

Codecov Report

Merging #994 (9d0cfd5) into unstable (ce0685c) will increase coverage by 0.00%.
The diff coverage is 100.00%.

❗ Current head 9d0cfd5 differs from pull request most recent head 9d0b90c. Consider uploading reports for the commit 9d0b90c to get more accurate results

Additional details and impacted files

Impacted file tree graph

@@            Coverage Diff            @@
##           unstable     #994   +/-   ##
=========================================
  Coverage     83.23%   83.24%           
=========================================
  Files            91       91           
  Lines         15328    15325    -3     
=========================================
- Hits          12759    12758    -1     
+ Misses         2569     2567    -2     
Files Coverage Δ
libp2p/dial.nim 50.87% <100.00%> (ø)
libp2p/dialer.nim 92.76% <100.00%> (ø)
libp2p/protocols/connectivity/dcutr/client.nim 72.09% <100.00%> (ø)
libp2p/protocols/connectivity/dcutr/server.nim 72.09% <100.00%> (ø)
libp2p/protocols/secure/secure.nim 77.55% <100.00%> (-0.23%) ⬇️
libp2p/switch.nim 91.32% <100.00%> (ø)
libp2p/transports/transport.nim 87.75% <100.00%> (+0.25%) ⬆️
libp2p/upgrademngrs/muxedupgrade.nim 88.70% <100.00%> (+1.01%) ⬆️
libp2p/upgrademngrs/upgrade.nim 100.00% <100.00%> (+3.33%) ⬆️

@diegomrsantos diegomrsantos marked this pull request as ready for review November 29, 2023 12:37
@diegomrsantos diegomrsantos changed the title fix(dcutr): set the client transport dir to In during dcutr fix(dcutr): set the DCUtR initiator transport direction to Inbound Nov 29, 2023
@diegomrsantos diegomrsantos changed the title fix(dcutr): set the DCUtR initiator transport direction to Inbound fix(dcutr): update the DCUtR initiator transport direction to Inbound Nov 29, 2023
@diegomrsantos diegomrsantos merged commit deb72c8 into unstable Nov 29, 2023
8 checks passed
@diegomrsantos diegomrsantos deleted the dcutr-transport-dir branch November 29, 2023 16:38
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Status: done
Development

Successfully merging this pull request may close these issues.

2 participants