fix: abort handshake if the torrent is stopped (#6947)

* fix: abort handshake if torrent isn't running

* fix: check if torrent is running in all cases

* fix: don't penalise peer if handshake failed because of us

* fix: tests

* perf: ensure copy-elision in `HandshakeMediator::torrent()`

* code review: more accurate log wording
This commit is contained in:
Yat Ho
2025-03-10 14:05:16 +08:00
committed by GitHub
parent 1232f558a6
commit 088232f69c
4 changed files with 27 additions and 18 deletions

View File

@@ -155,11 +155,13 @@ public:
tr_handshake::Mediator::TorrentInfo const TorrentWeAreSeeding{ tr_sha1::digest("abcde"sv),
tr_peerIdInit(),
tr_torrent_id_t{ 100 },
true /*is_done*/ };
true /*is_done*/,
true /*is_running*/ };
tr_handshake::Mediator::TorrentInfo const UbuntuTorrent{ *tr_sha1_from_string("2c6b6858d61da9543d4231a71db4b1c9264b0685"sv),
tr_peerIdInit(),
tr_torrent_id_t{ 101 },
false /*is_done*/ };
false /*is_done*/,
true /*is_running*/ };
auto createIncomingIo(tr_session* session)
{