webtorrent / bittorrent-tracker

🌊 Simple, robust, BitTorrent tracker (client & server) implementation
https://webtorrent.io
MIT License
1.75k stars 317 forks source link

fix(events): Support of `paused` client event #411

Closed pavloniym closed 2 years ago

pavloniym commented 2 years ago

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

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

What changes did you make? (Give an overview) Handle paused client request

Which issue (if any) does this pull request address? Some torrent clients (e.g. Transmission torrent client) receive 'invalid event' on paused request.

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

welcome[bot] commented 2 years ago

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

pavloniym commented 2 years ago

Are the changes okay for merging? @DiegoRBaquero @feross

DiegoRBaquero commented 2 years ago

is this part of a BEP? why weren't we handling it before?

github-actions[bot] commented 2 years ago

Is this still relevant? If so, what is blocking it? Is there anything you can do to help move it forward?

DiegoRBaquero commented 2 years ago

@pavloniym ?

pavloniym commented 2 years ago

@DiegoRBaquero, so sorry! Yes, you are completely right! As I understand, paused event is some kind of custom torrent-client event and is not part of BEP. So bittorrent-tracker should not support all custom events of all clients, it doesn't make sense... I am awfully sorry for my misunderstand.

Idea: add special flag to server configuration to ignore such custom events, without error throw

DiegoRBaquero commented 2 years ago

Where do you see the error thrown? It should only be a warning and ignored

pavloniym commented 2 years ago

If I understand you correctly: https://github.com/webtorrent/bittorrent-tracker/blob/master/lib/server/swarm.js#L51

In this place tracker return error as callback on client announce hook. Transmission provide paused event on torrent download complete, which is not supported (and not in BEP (and I think it is correct)), so show error to user.

I have a private torrent-tracker and more than 10% of users (300+ users) use Transmission. Many of them complaining about this error, I tried to explain them that "this error is normal" but not succeeded :)

To keep server code clean and support only BEP events — my idea is to add special flag to server configuration to ignore such custom events, without error throw

DiegoRBaquero commented 2 years ago

I see it in BEP21: http://bittorrent.org/beps/bep_0021.html

More ref: https://trac.transmissionbt.com/ticket/5883

I guess we can include it, as long as no official BEP overrides it.

welcome[bot] commented 2 years ago

🎉 Congrats on getting your first pull request landed!

webtorrent-bot commented 2 years ago

:tada: This PR is included in version 9.19.0 :tada:

The release is available on:

Your semantic-release bot :package::rocket: