Skip to content

Commit

Permalink
Merge pull request picotorrent#1271 from blomgrenskold/master
Browse files Browse the repository at this point in the history
Exposed a generous amount of libtorrent settings.
  • Loading branch information
vktr authored May 20, 2023
2 parents 79644e8 + ec74a79 commit c7f9975
Show file tree
Hide file tree
Showing 4 changed files with 160 additions and 8 deletions.
51 changes: 51 additions & 0 deletions res/dbmigrations/20230511023104_extend_advanced_settings.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
INSERT INTO setting (key, value, default_value)
VALUES
('libtorrent.allow_multiple_connections_per_ip', NULL, 'false'),
('libtorrent.allowed_fast_set_size', NULL, '5'),
('libtorrent.auto_manage_interval', NULL, '30'),
('libtorrent.auto_manage_prefer_seeds', NULL, 'false'),
('libtorrent.auto_scrape_interval', NULL, '1800'),
('libtorrent.auto_scrape_min_interval', NULL, '300'),
('libtorrent.checking_mem_usage', NULL, '256'),
('libtorrent.choking_algorithm', NULL, '0'),
('libtorrent.seed_choking_algorithm', NULL, '0'),
('libtorrent.connection_speed', NULL, '30'),
('libtorrent.disk_write_mode', NULL, '2'),
('libtorrent.dont_count_slow_torrents', NULL, 'true'),
('libtorrent.file_pool_size', NULL, '40'),
('libtorrent.hashing_threads', NULL, '1'),
('libtorrent.inactive_down_rate', NULL, '2048'),
('libtorrent.inactive_up_rate', NULL, '2048'),
('libtorrent.inactivity_timeout', NULL, '600'),
('libtorrent.incoming_starts_queued_torrents', NULL, 'false'),
('libtorrent.initial_picker_threshold', NULL, '4'),
('libtorrent.listen_queue_size', NULL, '5'),
('libtorrent.max_allowed_in_request_queue', NULL, '2000'),
('libtorrent.max_failcount', NULL, '3'),
('libtorrent.max_out_request_queue', NULL, '500'),
('libtorrent.max_peer_recv_buffer_size', NULL, '2097152'),
('libtorrent.max_queued_disk_bytes', NULL, '1048576'),
('libtorrent.max_rejects', NULL, '50'),
('libtorrent.min_reconnect_time', NULL, '60'),
('libtorrent.mixed_mode_algorithm', NULL, '1'),
('libtorrent.mmap_file_size_cutoff', NULL, '40'),
('libtorrent.no_atime_storage', NULL, 'true'),
('libtorrent.peer_timeout', NULL, '120'),
('libtorrent.peer_turnover', NULL, '4'),
('libtorrent.peer_turnover_interval', NULL, '90'),
('libtorrent.peer_turnover_cutoff', NULL, '300'),
('libtorrent.predictive_piece_announce', NULL, '0'),
('libtorrent.rate_choker_initial_threshold', NULL, '1024'),
('libtorrent.request_timeout', NULL, '60'),
('libtorrent.seed_time_ratio_limit', NULL, '700'),
('libtorrent.share_ratio_limit', NULL, '200'),
('libtorrent.send_buffer_low_watermark', NULL, '10240'),
('libtorrent.send_buffer_watermark', NULL, '512000'),
('libtorrent.send_buffer_watermark_factor', NULL, '50'),
('libtorrent.send_not_sent_low_watermark', NULL, '16384'),
('libtorrent.strict_end_game_mode', NULL, 'true'),
('libtorrent.suggest_mode', NULL, '0'),
('libtorrent.torrent_connect_boost', NULL, '30'),
('libtorrent.unchoke_slots_limit', NULL, '8'),
('libtorrent.use_parole_mode', NULL, 'true'),
('libtorrent.whole_pieces_threshold', NULL, '20');
51 changes: 51 additions & 0 deletions src/picotorrent/bittorrent/session.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -142,7 +142,58 @@ static lt::settings_pack getSettingsPack(std::shared_ptr<pt::Core::Configuration
settings.set_int(lt::settings_pack::active_lsd_limit, cfg->Get<int>("libtorrent.active_lsd_limit").value());
settings.set_int(lt::settings_pack::active_seeds, cfg->Get<int>("libtorrent.active_seeds").value());
settings.set_int(lt::settings_pack::active_tracker_limit, cfg->Get<int>("libtorrent.active_tracker_limit").value());
settings.set_int(lt::settings_pack::allowed_fast_set_size, cfg->Get<int>("libtorrent.allowed_fast_set_size").value());
settings.set_int(lt::settings_pack::auto_manage_interval, cfg->Get<int>("libtorrent.auto_manage_interval").value());
settings.set_int(lt::settings_pack::connections_limit, cfg->Get<int>("libtorrent.connections_limit").value());
settings.set_int(lt::settings_pack::connection_speed, cfg->Get<int>("libtorrent.connection_speed").value());
settings.set_int(lt::settings_pack::inactive_down_rate, cfg->Get<int>("libtorrent.inactive_down_rate").value());
settings.set_int(lt::settings_pack::inactive_up_rate, cfg->Get<int>("libtorrent.inactive_up_rate").value());
settings.set_int(lt::settings_pack::seed_time_ratio_limit, cfg->Get<int>("libtorrent.seed_time_ratio_limit").value());
settings.set_int(lt::settings_pack::share_ratio_limit, cfg->Get<int>("libtorrent.share_ratio_limit").value());

// Misc
settings.set_bool(lt::settings_pack::allow_multiple_connections_per_ip, cfg->Get<bool>("libtorrent.allow_multiple_connections_per_ip").value());
settings.set_bool(lt::settings_pack::auto_manage_prefer_seeds, cfg->Get<bool>("libtorrent.auto_manage_prefer_seeds").value());
settings.set_int(lt::settings_pack::auto_scrape_interval, cfg->Get<int>("libtorrent.auto_scrape_interval").value());
settings.set_int(lt::settings_pack::auto_scrape_min_interval, cfg->Get<int>("libtorrent.auto_scrape_min_interval").value());
settings.set_int(lt::settings_pack::checking_mem_usage, cfg->Get<int>("libtorrent.checking_mem_usage").value());
settings.set_int(lt::settings_pack::choking_algorithm, cfg->Get<int>("libtorrent.choking_algorithm").value());
settings.set_int(lt::settings_pack::seed_choking_algorithm, cfg->Get<int>("libtorrent.seed_choking_algorithm").value());
settings.set_int(lt::settings_pack::disk_write_mode, cfg->Get<int>("libtorrent.disk_write_mode").value());
settings.set_bool(lt::settings_pack::dont_count_slow_torrents, cfg->Get<bool>("libtorrent.dont_count_slow_torrents").value());
settings.set_int(lt::settings_pack::file_pool_size, cfg->Get<int>("libtorrent.file_pool_size").value());
settings.set_int(lt::settings_pack::hashing_threads, cfg->Get<int>("libtorrent.hashing_threads").value());
settings.set_int(lt::settings_pack::inactivity_timeout, cfg->Get<int>("libtorrent.inactivity_timeout").value());
settings.set_bool(lt::settings_pack::incoming_starts_queued_torrents, cfg->Get<bool>("libtorrent.incoming_starts_queued_torrents").value());
settings.set_int(lt::settings_pack::initial_picker_threshold, cfg->Get<int>("libtorrent.initial_picker_threshold").value());
settings.set_int(lt::settings_pack::listen_queue_size, cfg->Get<int>("libtorrent.listen_queue_size").value());
settings.set_int(lt::settings_pack::max_allowed_in_request_queue, cfg->Get<int>("libtorrent.max_allowed_in_request_queue").value());
settings.set_int(lt::settings_pack::max_failcount, cfg->Get<int>("libtorrent.max_failcount").value());
settings.set_int(lt::settings_pack::max_out_request_queue, cfg->Get<int>("libtorrent.max_out_request_queue").value());
settings.set_int(lt::settings_pack::max_peer_recv_buffer_size, cfg->Get<int>("libtorrent.max_peer_recv_buffer_size").value());
settings.set_int(lt::settings_pack::max_queued_disk_bytes, cfg->Get<int>("libtorrent.max_queued_disk_bytes").value());
settings.set_int(lt::settings_pack::max_rejects, cfg->Get<int>("libtorrent.max_rejects").value());
settings.set_int(lt::settings_pack::min_reconnect_time, cfg->Get<int>("libtorrent.min_reconnect_time").value());
settings.set_int(lt::settings_pack::mixed_mode_algorithm, cfg->Get<int>("libtorrent.mixed_mode_algorithm").value());
settings.set_int(lt::settings_pack::mmap_file_size_cutoff, cfg->Get<int>("libtorrent.mmap_file_size_cutoff").value());
settings.set_bool(lt::settings_pack::no_atime_storage, cfg->Get<bool>("libtorrent.no_atime_storage").value());
settings.set_int(lt::settings_pack::peer_timeout, cfg->Get<int>("libtorrent.peer_timeout").value());
settings.set_int(lt::settings_pack::peer_turnover, cfg->Get<int>("libtorrent.peer_turnover").value());
settings.set_int(lt::settings_pack::peer_turnover_cutoff, cfg->Get<int>("libtorrent.peer_turnover_cutoff").value());
settings.set_int(lt::settings_pack::peer_turnover_interval, cfg->Get<int>("libtorrent.peer_turnover_interval").value());
settings.set_int(lt::settings_pack::predictive_piece_announce, cfg->Get<int>("libtorrent.predictive_piece_announce").value());
settings.set_int(lt::settings_pack::rate_choker_initial_threshold, cfg->Get<int>("libtorrent.rate_choker_initial_threshold").value());
settings.set_int(lt::settings_pack::request_timeout, cfg->Get<int>("libtorrent.request_timeout").value());
settings.set_int(lt::settings_pack::send_buffer_low_watermark, cfg->Get<int>("libtorrent.send_buffer_low_watermark").value());
settings.set_int(lt::settings_pack::send_buffer_watermark, cfg->Get<int>("libtorrent.send_buffer_watermark").value());
settings.set_int(lt::settings_pack::send_buffer_watermark_factor, cfg->Get<int>("libtorrent.send_buffer_watermark_factor").value());
settings.set_int(lt::settings_pack::send_not_sent_low_watermark, cfg->Get<int>("libtorrent.send_not_sent_low_watermark").value());
settings.set_bool(lt::settings_pack::strict_end_game_mode, cfg->Get<bool>("libtorrent.strict_end_game_mode").value());
settings.set_int(lt::settings_pack::suggest_mode, cfg->Get<int>("libtorrent.suggest_mode").value());
settings.set_int(lt::settings_pack::torrent_connect_boost, cfg->Get<int>("libtorrent.torrent_connect_boost").value());
settings.set_int(lt::settings_pack::unchoke_slots_limit, cfg->Get<int>("libtorrent.unchoke_slots_limit").value());
settings.set_bool(lt::settings_pack::use_parole_mode, cfg->Get<bool>("libtorrent.use_parole_mode").value());
settings.set_int(lt::settings_pack::whole_pieces_threshold, cfg->Get<int>("libtorrent.whole_pieces_threshold").value());

// Tracker things
settings.set_bool(lt::settings_pack::announce_to_all_tiers, cfg->Get<bool>("libtorrent.announce_to_all_tiers").value());
Expand Down
1 change: 1 addition & 0 deletions src/picotorrent/resources.rc
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ ICO_TERMINAL_DARK_THEME ICON "..\\..\\res\\terminal-dark-theme.ico"
20201219222232_insert_connections_limit DBMIGRATION "..\\..\\res\\dbmigrations\\20201219222232_insert_connections_limit.sql"
20201227195100_insert_ipfilter_settings DBMIGRATION "..\\..\\res\\dbmigrations\\20201227195100_insert_ipfilter_settings.sql"
20220508103321_insert_theme_id DBMIGRATION "..\\..\\res\\dbmigrations\\20220508103321_insert_theme_id.sql"
20230511023104_extend_advanced_settings DBMIGRATION "..\\..\\res\\dbmigrations\\20230511023104_extend_advanced_settings.sql"

VS_VERSION_INFO VERSIONINFO
FILEVERSION VER_FILE_VERSION
Expand Down
Loading

0 comments on commit c7f9975

Please sign in to comment.