https://bugs.kde.org/show_bug.cgi?id=508964

--- Comment #13 from Nicolás <[email protected]> ---
Wish I knew more Qt and C++... I suspect something here (queuemanager.cpp):

TorrentStartResponse QueueManager::startInternal(bt::TorrentInterface *tc)
{
    const TorrentStats &s = tc->getStats();

    if (!s.completed && !checkDiskSpace(tc, false)) {
        return bt::NOT_ENOUGH_DISKSPACE;
    } else if (s.completed && !checkLimits(tc, false)) {
        return bt::MAX_SHARE_RATIO_REACHED;
    }

    Out(SYS_GEN | LOG_NOTICE) << "Starting download " << s.torrent_name <<
endl;
    startSafely(tc);
    return START_OK;
}

Before "return START_OK;", shouldn't we reset to 0 the stalled time property?

I'm also wondering if in startSafely() shouldn't we reset to 0 the stalled time
property as well?

void QueueManager::startSafely(bt::TorrentInterface *tc)
{
    try {
        tc->start();
    } catch (bt::Error &err) {
        const TorrentStats &s = tc->getStats();
        QString msg = i18n("Error starting torrent %1: %2", s.torrent_name,
err.toString());
        KMessageBox::error(nullptr, msg, i18n("Error"));
    }
}

I went also upper in torrentservice.cpp, which has the ::start() that is called
in the two previous extracts. Should we reset the time stalled property here
directly?

void TorrentService::start()
{
    bt::Uint16 port = bt::ServerInterface::getPort();
    QString name = QStringLiteral("%1__%2%3")
                       .arg(tc->getOwnPeerID().toString())
                       .arg(QRandomGenerator::global()->bounded(26) + 65)
                       .arg(QRandomGenerator::global()->bounded(26) + 65);
    QStringList subtypes;
    subtypes << QLatin1Char('_') + tc->getInfoHash().toString() +
QStringLiteral("._sub._bittorrent._tcp");
(...)

-- 
You are receiving this mail because:
You are watching all bug changes.

Reply via email to