8000 adds bep_0014 (local peer discovery) by philrhc · Pull Request #998 · anacrolix/torrent · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

adds bep_0014 (local peer discovery) #998

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

Open
wants to merge 53 commits into
base: master
Choose a base branch
from

Conversation

philrhc
Copy link
Contributor
@philrhc philrhc commented Feb 28, 2025

@anacrolix
Copy link
Owner

Are you interested in refactoring it a bit (totally fine if not). I think we could move the LPD stuff into a separate package, probably just ./lpd, or bep14 or lsd (not sure why LSD and LPD are mixed and matched in the literature here), mainly just to not clutter the API more.

What are the licence requirements for this? I note @axet has forgotten the MPL2 licence throughout his codebase. He's got LGPL3 for his code, so does that need to be reflected here?

@anacrolix
Copy link
Owner

Thanks :)

@anacrolix
Copy link
Owner

There are some race conditions. Run the tests with -race on your system.

bep14.go Outdated
Comment on lines 133 to 137
if client.LocalPort() == addr.Port {
log.Println("discovered self")
client.rUnlock()
continue
}
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

self is no longer discovered but only considering port number for the first listener that has one seems a bit fragile...
could publish peer id in the message but i guess this could cause parsing problems with other clients? https://bittorrent.org/beps/bep_0014.html

@anacrolix
Copy link
Owner

This is looking very good, thanks for taking feedback on board. I'll give a more detailed response shortly.

adds network interface selection
go.mod Outdated
Comment on lines 3 to 5
go 1.23.0

toolchain go1.24.1
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

a little confused about how i've caused this, i think it's because of requiring:
"golang.org/x/net/ipv4"
"golang.org/x/net/ipv6"
but i can't work out exactly why...

Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There's a bug in Go, they just pushed a fix to master golang/go#65847 (comment)

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yes i see something funky happening here
https://github.com/philrhc/torrent/actions/runs/14750112335/job/41406098250
Common Go seems to download 3 versions of the toolchain, 1.23.0, 1.23.8 and the upgraded 1.24.2. I wonder if this will happen to any pull request that upgrades the go version. I will investigate how this action cache works...

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ok, i think the caching is working okay now that all versions of go are 1.24.2. I am speculating that some part of the code does not work with Windows and this causes the test timeout...

Phil Cummins added 13 commits April 30, 2025 08:47
github.com/anacrolix/torrent/analysis
github.com/anacrolix/torrent/bencode
github.com/anacrolix/torrent/cmd/magnet-metainfo
github.com/anacrolix/torrent/cmd/torrent
github.com/anacrolix/torrent/cmd/torrent-pick
github.com/anacrolix/torrent/cmd/torrent2
github.com/anacrolix/torrent/common
github.com/anacrolix/torrent/dialer
github.com/anacrolix/torrent/internal/alloclim
github.com/anacrolix/torrent/internal/check
github.com/anacrolix/torrent/internal/cmd/issue-464
github.com/anacrolix/torrent/internal/cmd/issue-465
github.com/anacrolix/torrent/internal/cmd/issue-906
github.com/anacrolix/torrent/internal/cmd/issue-908
github.com/anacrolix/torrent/internal/ctxrw
github.com/anacrolix/torrent/internal/limiter
github.com/anacrolix/torrent/internal/nestedmaps
github.com/anacrolix/torrent/internal/panicif
github.com/anacrolix/torrent/internal/testutil
github.com/anacrolix/torrent/iplist
github.com/anacrolix/torrent/iplist/cmd/iplist
github.com/anacrolix/torrent/iplist/cmd/pack-blocklist
github.com/anacrolix/torrent/logonce
github.com/anacrolix/torrent/merkle
github.com/anacrolix/torrent/metainfo
github.com/anacrolix/torrent/mmap_span
github.com/anacrolix/torrent/mse
github.com/anacrolix/torrent/mse/cmd/mse
github.com/anacrolix/torrent/peer_protocol
github.com/anacrolix/torrent/peer_protocol/ut-holepunch
github.com/anacrolix/torrent/request-strategy
github.com/anacrolix/torrent/segments
github.com/anacrolix/torrent/smartban
github.com/anacrolix/torrent/storage
github.com/anacrolix/torrent/storage/disabled
github.com/anacrolix/torrent/storage/sqlite
github.com/anacrolix/torrent/storage/test
github.com/anacrolix/torrent/test
github.com/anacrolix/torrent/tests/issue-798
github.com/anacrolix/torrent/tests/issue-930
github.com/anacrolix/torrent/tests/issue-952
github.com/anacrolix/torrent/tests/peers-bootstrapping
github.com/anacrolix/torrent/tracker
github.com/anacrolix/torrent/tracker/http
github.com/anacrolix/torrent/tracker/http/server
github.com/anacrolix/torrent/tracker/server
github.com/anacrolix/torrent/tracker/shared
github.com/anacrolix/torrent/tracker/udp
github.com/anacrolix/torrent/tracker/udp/server
github.com/anacrolix/torrent/typed-roaring
github.com/anacrolix/torrent/types
github.com/anacrolix/torrent/types/infohash
github.com/anacrolix/torrent/types/infohash-v2
github.com/anacrolix/torrent/util/dirwatch
github.com/anacrolix/torrent/version
github.com/anacrolix/torrent/webseed
github.com/anacrolix/torrent/webtorrent
@philrhc
Copy link
Contributor Author
philrhc commented Apr 30, 2025

i am currently not able to find the reason the windows runner cannot complete TestDiscovery. I'll give this a rest now...

@anacrolix
Copy link
Owner

i am currently not able to find the reason the windows runner cannot complete TestDiscovery. I'll give this a rest now...

Ah, Windows probably does very different things with regard to multicast. I had to do similar hackery for anacrolix/dms. https://github.com/anacrolix/dms/blob/1291628af96c12c6a81ad900021f9da912bc8fd5/ssdp/ssdp.go#L115

@philrhc
Copy link
Contributor Author
philrhc commented May 21, 2025

i am currently not able to find the reason the windows runner cannot complete TestDiscovery. I'll give this a rest now...

Ah, Windows probably does very different things with regard to multicast. I had to do similar hackery for anacrolix/dms. https://github.com/anacrolix/dms/blob/1291628af96c12c6a81ad900021f9da912bc8fd5/ssdp/ssdp.go#L115

good to know, thanks. I'm planning to take a look at this again soon

@philrhc
Copy link
Contributor Author
philrhc commented Jun 26, 2025

hi, thought i'd check in :)
i'm testing this on the Fabric testbed, and so far so good, when it scales to 30 nodes then sometimes one node doesn't complete the download, it doesn't seem to be a network issue because the failure can change over repeated tests with the same set of nodes.

thank you for the fantastic work over the years, it's been a pleasure to use torrent and confluence :)

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.

2 participants
0