Skip to content

fix(yamux): yamux uses wrong direction during dcutr#992

Closed
diegomrsantos wants to merge 5 commits intounstablefrom
yamux-over-dcutr
Closed

fix(yamux): yamux uses wrong direction during dcutr#992
diegomrsantos wants to merge 5 commits intounstablefrom
yamux-over-dcutr

Conversation

@diegomrsantos
Copy link
Contributor

@diegomrsantos diegomrsantos commented Nov 21, 2023

During DCUtR, the listener initiates the direct connection 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 underlying connection direction -which in this case is TCP (or another transport) outgoing as the peer is initiating the connection.

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 this peer 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 22, 2023

Codecov Report

Merging #992 (5bd55be) into unstable (ce0685c) will increase coverage by 0.01%.
The diff coverage is 100.00%.

Additional details and impacted files

Impacted file tree graph

@@             Coverage Diff              @@
##           unstable     #992      +/-   ##
============================================
+ Coverage     83.23%   83.25%   +0.01%     
============================================
  Files            91       91              
  Lines         15328    15331       +3     
============================================
+ Hits          12759    12764       +5     
+ Misses         2569     2567       -2     
Files Coverage Δ
libp2p/builders.nim 93.05% <100.00%> (ø)
libp2p/dialer.nim 92.73% <ø> (-0.04%) ⬇️
libp2p/muxers/muxer.nim 72.00% <ø> (ø)
libp2p/muxers/yamux/yamux.nim 89.72% <100.00%> (+0.03%) ⬆️
libp2p/upgrademngrs/muxedupgrade.nim 87.69% <100.00%> (ø)

... and 2 files with indirect coverage changes

@diegomrsantos diegomrsantos changed the title Yamux over dcutr fix(yamux): yamux uses wrong direction during dcutr Nov 23, 2023
@diegomrsantos diegomrsantos marked this pull request as ready for review November 23, 2023 09:49
@diegomrsantos
Copy link
Contributor Author

This is replaced by #994

@vladopajic vladopajic deleted the yamux-over-dcutr branch November 10, 2025 19:56
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.

1 participant