Skip to content

Conversation

@Shresthap21
Copy link

What is the purpose of this pull request? (put an "X" next to item)

[ ] Documentation update
[X] Bug fix
[ ] New feature
[ ] Other, please explain:

What changes did you make? (Give an overview)

Fixed PeX (Peer Exchange) functionality to properly send local peers to remote peers. The issue was that ut_pex.start() was never called and existing wire peers weren't shared with new PeX instances.

Changes made:

  • Call ut_pex.start() after wire.use(utPex()) to start the PeX message timer
  • Share existing wire addresses with new PeX instances to enable peer exchange
  • Add comprehensive tests in test/node/pex.js to verify functionality

Which issue (if any) does this pull request address?

Fixes #2919

Is there anything you'd like reviewers to focus on?

Please review:

  1. The peer sharing logic in lib/torrent.js - ensuring existing wires are properly shared with new PeX instances
  2. The ut_pex.start() call placement and timing
  3. Test coverage in test/node/pex.js - verifies timer starts, peer sharing works, and cleanup is proper

- Start PeX timer by calling ut_pex.start() after wire.use(utPex())
- Share existing wire peers with new PeX instances to enable peer exchange
- Add comprehensive tests for PeX functionality

Fixes webtorrent#2919
@welcome
Copy link

welcome bot commented Oct 11, 2025

🙌 Thanks for opening this pull request! You're awesome.

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.

PeX never sends it's own local peers, only receives from remote.

1 participant