mirror of
https://github.com/d47081/qBittorrent.git
synced 2025-01-24 05:25:37 +00:00
Rewrite TrackerList::reannounceSelected(), now it can force reannounce DHT
This commit is contained in:
parent
5e400d3117
commit
fb1772f019
@ -400,16 +400,23 @@ void TrackerList::editSelectedTracker() {
|
|||||||
|
|
||||||
#if LIBTORRENT_VERSION_NUM >= 10000
|
#if LIBTORRENT_VERSION_NUM >= 10000
|
||||||
void TrackerList::reannounceSelected() {
|
void TrackerList::reannounceSelected() {
|
||||||
BitTorrent::TorrentHandle *const torrent = properties->getCurrentTorrent();
|
QList<QTreeWidgetItem *> selected_items = selectedItems();
|
||||||
if (!torrent) return;
|
|
||||||
|
|
||||||
QList<QTreeWidgetItem *> selected_items = getSelectedTrackerItems();
|
|
||||||
if (selected_items.isEmpty()) return;
|
if (selected_items.isEmpty()) return;
|
||||||
|
|
||||||
|
BitTorrent::TorrentHandle *const torrent = properties->getCurrentTorrent();
|
||||||
|
if (!torrent) return;
|
||||||
QList<BitTorrent::TrackerEntry> trackers = torrent->trackers();
|
QList<BitTorrent::TrackerEntry> trackers = torrent->trackers();
|
||||||
for (int i = 0; i < trackers.size(); ++i) {
|
|
||||||
foreach (QTreeWidgetItem* w, selected_items) {
|
foreach (QTreeWidgetItem* item, selected_items) {
|
||||||
if (w->text(COL_URL) == trackers[i].url()) {
|
// DHT case
|
||||||
|
if (item == dht_item) {
|
||||||
|
torrent->forceDHTAnnounce();
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Trackers case
|
||||||
|
for (int i = 0; i < trackers.size(); ++i) {
|
||||||
|
if (item->text(COL_URL) == trackers[i].url()) {
|
||||||
torrent->forceReannounce(i);
|
torrent->forceReannounce(i);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user