Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Don't force the trackers to scrape when rTorrent first starts #31

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions include/core/download_factory.h
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,13 @@ class DownloadFactory {
void set_start(bool v) {
m_start = v;
}

bool get_init_load() const {
return m_initLoad;
}
void set_init_load(bool v) {
m_initLoad = v;
}

bool print_log() const {
return m_printLog;
Expand Down Expand Up @@ -103,6 +110,7 @@ class DownloadFactory {
bool m_printLog{ true };
bool m_immediate{ false };
bool m_isFile{ false };
bool m_initLoad{ false };

command_list_type m_commands;
torrent::Object::map_type m_variables;
Expand Down
4 changes: 4 additions & 0 deletions src/core/download_factory.cc
Original file line number Diff line number Diff line change
Expand Up @@ -298,6 +298,10 @@ DownloadFactory::receive_success() {

if (!rpc::call_command_value("trackers.use_udp"))
download->enable_udp_trackers(false);

// Don't force the trackers to scrape when rTorrent first starts
if (m_initLoad)
download->set_resume_flags(torrent::Download::start_skip_tracker);

// Check first if we already have these values set in the session
// torrent, so that it is safe to change the values.
Expand Down
2 changes: 2 additions & 0 deletions src/main.cc
Original file line number Diff line number Diff line change
Expand Up @@ -165,6 +165,7 @@ load_session_torrents(indicators::BlockProgressBar*& progress_bar) {

// Replace with session torrent flag.
f->set_session(true);
f->set_init_load(true);
f->slot_finished([f, &progress_bar, entries_size]() {
if (control->is_shutdown_received()) {
throw std::runtime_error("shutdown received. aborting...");
Expand All @@ -191,6 +192,7 @@ load_arg_torrents(char** first, char** last) {

// Replace with session torrent flag.
f->set_start(true);
f->set_init_load(true);
f->slot_finished([f]() { delete f; });
f->load(*first);
f->commit();
Expand Down