1
0
mirror of https://github.com/d47081/qBittorrent.git synced 2025-01-23 04:54:18 +00:00

- Made seed detection a bit safer (do not use progress)

This commit is contained in:
Christophe Dumez 2008-12-27 09:10:07 +00:00
parent a3cfa6bba1
commit 384f3b23ee
2 changed files with 6 additions and 3 deletions

View File

@ -78,12 +78,12 @@ void EventManager::modifiedTorrent(QTorrentHandle h)
} }
event["name"] = QVariant(h.name()); event["name"] = QVariant(h.name());
event["size"] = QVariant((qlonglong)h.actual_size()); event["size"] = QVariant((qlonglong)h.actual_size());
if(h.progress() < 1.) { if(!h.is_seed()) {
event["progress"] = QVariant(h.progress()); event["progress"] = QVariant(h.progress());
event["dlspeed"] = QVariant(h.download_payload_rate()); event["dlspeed"] = QVariant(h.download_payload_rate());
} }
event["upspeed"] = QVariant(h.upload_payload_rate()); event["upspeed"] = QVariant(h.upload_payload_rate());
event["seed"] = QVariant(h.progress() == 1.); event["seed"] = QVariant(h.is_seed());
event["hash"] = QVariant(hash); event["hash"] = QVariant(hash);
event_list[hash] = event; event_list[hash] = event;
} }

View File

@ -285,7 +285,10 @@ bool QTorrentHandle::is_seed() const {
Q_ASSERT(h.is_valid()); Q_ASSERT(h.is_valid());
// Affected by bug http://code.rasterbar.com/libtorrent/ticket/402 // Affected by bug http://code.rasterbar.com/libtorrent/ticket/402
//return h.is_seed(); //return h.is_seed();
return (progress() == 1.); // May suffer from approximation problems
//return (progress() == 1.);
// This looks safe
return (state() == torrent_status::finished || state() == torrent_status::seeding);
} }
bool QTorrentHandle::is_auto_managed() const { bool QTorrentHandle::is_auto_managed() const {