|
|
@ -1039,6 +1039,11 @@ void Session::configure(libtorrent::settings_pack &settingsPack) |
|
|
|
settingsPack.set_int(libt::settings_pack::active_tracker_limit, -1); |
|
|
|
settingsPack.set_int(libt::settings_pack::active_tracker_limit, -1); |
|
|
|
settingsPack.set_int(libt::settings_pack::active_dht_limit, -1); |
|
|
|
settingsPack.set_int(libt::settings_pack::active_dht_limit, -1); |
|
|
|
settingsPack.set_int(libt::settings_pack::active_lsd_limit, -1); |
|
|
|
settingsPack.set_int(libt::settings_pack::active_lsd_limit, -1); |
|
|
|
|
|
|
|
// 1 active torrent force 2 connections. If you have more active torrents * 2 than connection limit,
|
|
|
|
|
|
|
|
// connection limit will get extended. Multiply max connections or active torrents by 10 for queue.
|
|
|
|
|
|
|
|
// Ignore -1 values because we don't want to set a max int message queue
|
|
|
|
|
|
|
|
settingsPack.set_int(libt::settings_pack::alert_queue_size, std::max(1000, |
|
|
|
|
|
|
|
10 * std::max(maxActiveTorrents() * 2, maxConnections()))); |
|
|
|
|
|
|
|
|
|
|
|
// Outgoing ports
|
|
|
|
// Outgoing ports
|
|
|
|
settingsPack.set_int(libt::settings_pack::outgoing_port, outgoingPortsMin()); |
|
|
|
settingsPack.set_int(libt::settings_pack::outgoing_port, outgoingPortsMin()); |
|
|
@ -1180,6 +1185,11 @@ void Session::configure(libtorrent::session_settings &sessionSettings) |
|
|
|
sessionSettings.active_tracker_limit = -1; |
|
|
|
sessionSettings.active_tracker_limit = -1; |
|
|
|
sessionSettings.active_dht_limit = -1; |
|
|
|
sessionSettings.active_dht_limit = -1; |
|
|
|
sessionSettings.active_lsd_limit = -1; |
|
|
|
sessionSettings.active_lsd_limit = -1; |
|
|
|
|
|
|
|
// 1 active torrent force 2 connections. If you have more active torrents * 2 than connection limit,
|
|
|
|
|
|
|
|
// connection limit will get extended. Multiply max connections or active torrents by 10 for queue.
|
|
|
|
|
|
|
|
// Ignore -1 values because we don't want to set a max int message queue
|
|
|
|
|
|
|
|
sessionSettings.alert_queue_size = std::max(1000, |
|
|
|
|
|
|
|
10 * std::max(maxActiveTorrents() * 2, maxConnections())); |
|
|
|
|
|
|
|
|
|
|
|
// Outgoing ports
|
|
|
|
// Outgoing ports
|
|
|
|
sessionSettings.outgoing_ports = std::make_pair(outgoingPortsMin(), outgoingPortsMax()); |
|
|
|
sessionSettings.outgoing_ports = std::make_pair(outgoingPortsMin(), outgoingPortsMax()); |
|
|
@ -3044,13 +3054,19 @@ void Session::startUpTorrents() |
|
|
|
QByteArray data; |
|
|
|
QByteArray data; |
|
|
|
} TorrentResumeData; |
|
|
|
} TorrentResumeData; |
|
|
|
|
|
|
|
|
|
|
|
auto startupTorrent = [this, logger, resumeDataDir](const TorrentResumeData ¶ms) |
|
|
|
int resumedTorrentsCount = 0; |
|
|
|
|
|
|
|
const auto startupTorrent = [this, logger, &resumeDataDir, &resumedTorrentsCount](const TorrentResumeData ¶ms) |
|
|
|
{ |
|
|
|
{ |
|
|
|
QString filePath = resumeDataDir.filePath(QString("%1.torrent").arg(params.hash)); |
|
|
|
QString filePath = resumeDataDir.filePath(QString("%1.torrent").arg(params.hash)); |
|
|
|
qDebug() << "Starting up torrent" << params.hash << "..."; |
|
|
|
qDebug() << "Starting up torrent" << params.hash << "..."; |
|
|
|
if (!addTorrent_impl(params.addTorrentData, params.magnetUri, TorrentInfo::loadFromFile(filePath), params.data)) |
|
|
|
if (!addTorrent_impl(params.addTorrentData, params.magnetUri, TorrentInfo::loadFromFile(filePath), params.data)) |
|
|
|
logger->addMessage(tr("Unable to resume torrent '%1'.", "e.g: Unable to resume torrent 'hash'.") |
|
|
|
logger->addMessage(tr("Unable to resume torrent '%1'.", "e.g: Unable to resume torrent 'hash'.") |
|
|
|
.arg(params.hash), Log::CRITICAL); |
|
|
|
.arg(params.hash), Log::CRITICAL); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// process add torrent messages before message queue overflow
|
|
|
|
|
|
|
|
if (resumedTorrentsCount % 100 == 0) readAlerts(); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
++resumedTorrentsCount; |
|
|
|
}; |
|
|
|
}; |
|
|
|
|
|
|
|
|
|
|
|
qDebug("Starting up torrents"); |
|
|
|
qDebug("Starting up torrents"); |
|
|
|