Browse Source

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

adaptive-webui-19844
Christophe Dumez 16 years ago
parent
commit
384f3b23ee
  1. 4
      src/eventmanager.cpp
  2. 5
      src/qtorrenthandle.cpp

4
src/eventmanager.cpp

@ -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;
} }

5
src/qtorrenthandle.cpp

@ -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 {

Loading…
Cancel
Save