fix: limit number of bad pieces to accept from a webseed
Fixes #267.
Notes: Limit the number of bad pieces to accept from a webseed before banning it.
Anybody know of a webseed I can test this PR with? The webseeds provided by the issue either isn't working anymore, or is not corrupt.
Anybody know of a webseed I can test this PR with? The webseeds provided by the issue either isn't working anymore, or is not corrupt.
Arch uses webseeds. https://archlinux.org/releng/releases/
It has to be webseeds that distribute corrupt data.
@tearfur probably the best way to do this reliably is to do it locally, e.g. with a local webserver and a torrent with a localhost webseed. Then after creating the .torrent file, overwrite all the file contents with bad data and serve it up on the local webserver.
Finished testing, looks to be working as intended.
[2024-06-12 07:24:04.768] trc test.dat increasing peer localhost:80 strike count to 1 (peer-mgr.cc:646)
[2024-06-12 07:24:04.768] trc test.dat increasing peer localhost:80 strike count to 2 (peer-mgr.cc:646)
[2024-06-12 07:24:04.768] trc test.dat increasing peer localhost:80 strike count to 3 (peer-mgr.cc:646)
[2024-06-12 07:24:04.768] trc test.dat increasing peer localhost:80 strike count to 4 (peer-mgr.cc:646)
[2024-06-12 07:24:04.768] trc test.dat increasing peer localhost:80 strike count to 5 (peer-mgr.cc:646)
[2024-06-12 07:24:04.768] trc test.dat banning peer localhost:80 (peer-mgr.cc:651)