Skip to content

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

Merged
diegomrsantos merged 5 commits intounstablefrom
dcutr-transport-dir
Nov 29, 2023
Merged

fix(dcutr): update the DCUtR initiator transport direction to Inbound#994
diegomrsantos merged 5 commits intounstablefrom
dcutr-transport-dir

Conversation

@diegomrsantos
Copy link
Contributor

@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

@codecov
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
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Archived in project

Development

Successfully merging this pull request may close these issues.

2 participants