Skip to content

Commit

Permalink
update to libtorrent master HEAD, version 2.1.0-35 (#283)
Browse files Browse the repository at this point in the history
  • Loading branch information
aldenml authored Nov 18, 2024
1 parent 5c9ec7f commit 0245a7b
Show file tree
Hide file tree
Showing 7 changed files with 67 additions and 7 deletions.
2 changes: 1 addition & 1 deletion build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ plugins {
}

group = "org.libtorrent4j"
version = "2.1.0-34"
version = "2.1.0-35"

java {
// using java 8 for android compatibility
Expand Down
7 changes: 7 additions & 0 deletions changelog.txt
Original file line number Diff line number Diff line change
@@ -1,3 +1,10 @@
2.1.0-35

* update to libtorrent master
* lt:fix, abort_download() is OK in any state
* lt:fix race condition when cancelling requests after becoming a seed
* lt:add announce_port setting

2.1.0-34

* update to libtorrent master
Expand Down
4 changes: 2 additions & 2 deletions src/main/java/org/libtorrent4j/LibTorrent.java
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ public static String version() {
* @return the git revision
*/
public static String revision() {
return "ed10d6c6063001d4b1aac5604761ed175e28d6b4";
return "62eae38e4beb80f8290dd230eb008830f5324b11";
}

/**
Expand Down Expand Up @@ -71,7 +71,7 @@ public static String opensslVersion() {
* @return libtorrent4j version.
*/
public static String libtorrent4jVersion() {
return "2.1.0-34";
return "2.1.0-35";
}

/**
Expand Down
43 changes: 42 additions & 1 deletion src/main/java/org/libtorrent4j/SettingsPack.java
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2018-2020, Alden Torres
* Copyright (c) 2018-2024, Alden Torres
*
* Licensed under the terms of the MIT license.
* Copy of the license at https://opensource.org/licenses/MIT
Expand Down Expand Up @@ -698,6 +698,47 @@ public SettingsPack alertQueueSize(int value) {
return this;
}

/**
* <code>announce_port</code> is the port passed along as the <code>port</code> parameter
* to remote trackers such as HTTP or DHT. This setting does not affect
* the effective listening port nor local service discovery announcements.
* If left as zero (default), the listening port value is used.
* <p>
* This setting is only meant for very special cases where a
* seed's listening port differs from the external port. As an
* example, if a local proxy is used and that the proxy supports
* reverse tunnels through NAT-PMP, the tracker must connect to
* the external NAT-PMP port (configured using <code>announce_port</code>)
* instead of the actual local listening port.
*
* @return the current value
* @see #setAnnouncePort(int)
*/
public int getAnnouncePort() {
return h.get_int(settings_pack.int_types.announce_port.swigValue());
}

/**
* <code>announce_port</code> is the port passed along as the <code>port</code> parameter
* to remote trackers such as HTTP or DHT. This setting does not affect
* the effective listening port nor local service discovery announcements.
* If left as zero (default), the listening port value is used.
* <p>
* This setting is only meant for very special cases where a
* seed's listening port differs from the external port. As an
* example, if a local proxy is used and that the proxy supports
* reverse tunnels through NAT-PMP, the tracker must connect to
* the external NAT-PMP port (configured using <code>announce_port</code>)
* instead of the actual local listening port.
*
* @param value the new value
* @return this
*/
public SettingsPack setAnnouncePort(int value) {
h.set_int(settings_pack.int_types.announce_port.swigValue(), value);
return this;
}

/**
* Returns a `SettingsPack` with every setting set to its default value.
*/
Expand Down
3 changes: 2 additions & 1 deletion src/main/java/org/libtorrent4j/swig/settings_pack.java
Original file line number Diff line number Diff line change
Expand Up @@ -445,6 +445,7 @@ public final static class int_types {
public final static settings_pack.int_types i2p_outbound_quantity = new settings_pack.int_types("i2p_outbound_quantity");
public final static settings_pack.int_types i2p_inbound_length = new settings_pack.int_types("i2p_inbound_length");
public final static settings_pack.int_types i2p_outbound_length = new settings_pack.int_types("i2p_outbound_length");
public final static settings_pack.int_types announce_port = new settings_pack.int_types("announce_port");
public final static settings_pack.int_types min_websocket_announce_interval = new settings_pack.int_types("min_websocket_announce_interval");
public final static settings_pack.int_types webtorrent_connection_timeout = new settings_pack.int_types("webtorrent_connection_timeout");
public final static settings_pack.int_types max_int_setting_internal = new settings_pack.int_types("max_int_setting_internal");
Expand Down Expand Up @@ -483,7 +484,7 @@ private int_types(String swigName, int_types swigEnum) {
swigNext = this.swigValue+1;
}

private static int_types[] swigValues = { tracker_completion_timeout, tracker_receive_timeout, stop_tracker_timeout, tracker_maximum_response_length, piece_timeout, request_timeout, request_queue_time, max_allowed_in_request_queue, max_out_request_queue, whole_pieces_threshold, peer_timeout, urlseed_timeout, urlseed_pipeline_size, urlseed_wait_retry, file_pool_size, max_failcount, min_reconnect_time, peer_connect_timeout, connection_speed, inactivity_timeout, unchoke_interval, optimistic_unchoke_interval, num_want, initial_picker_threshold, allowed_fast_set_size, suggest_mode, max_queued_disk_bytes, handshake_timeout, send_buffer_low_watermark, send_buffer_watermark, send_buffer_watermark_factor, choking_algorithm, seed_choking_algorithm, disk_io_write_mode, disk_io_read_mode, outgoing_port, num_outgoing_ports, peer_dscp, active_downloads, active_seeds, active_checking, active_dht_limit, active_tracker_limit, active_lsd_limit, active_limit, auto_manage_interval, seed_time_limit, auto_scrape_interval, auto_scrape_min_interval, max_peerlist_size, max_paused_peerlist_size, min_announce_interval, auto_manage_startup, seeding_piece_quota, max_rejects, recv_socket_buffer_size, send_socket_buffer_size, max_peer_recv_buffer_size, optimistic_disk_retry, max_suggest_pieces, local_service_announce_interval, dht_announce_interval, udp_tracker_token_expiry, num_optimistic_unchoke_slots, max_pex_peers, tick_interval, share_mode_target, upload_rate_limit, download_rate_limit, dht_upload_rate_limit, unchoke_slots_limit, connections_limit, connections_slack, utp_target_delay, utp_gain_factor, utp_min_timeout, utp_syn_resends, utp_fin_resends, utp_num_resends, utp_connect_timeout, utp_loss_multiplier, mixed_mode_algorithm, listen_queue_size, torrent_connect_boost, alert_queue_size, max_metadata_size, hashing_threads, checking_mem_usage, predictive_piece_announce, aio_threads, tracker_backoff, share_ratio_limit, seed_time_ratio_limit, peer_turnover, peer_turnover_cutoff, peer_turnover_interval, connect_seed_every_n_download, max_http_recv_buffer_size, max_retry_port_bind, alert_mask, out_enc_policy, in_enc_policy, allowed_enc_level, inactive_down_rate, inactive_up_rate, proxy_type, proxy_port, i2p_port, urlseed_max_request_bytes, web_seed_name_lookup_retry, close_file_interval, utp_cwnd_reduce_timer, max_web_seed_connections, resolver_cache_timeout, send_not_sent_low_watermark, rate_choker_initial_threshold, upnp_lease_duration, max_concurrent_http_announces, dht_max_peers_reply, dht_search_branching, dht_max_fail_count, dht_max_torrents, dht_max_dht_items, dht_max_peers, dht_max_torrent_search_reply, dht_block_timeout, dht_block_ratelimit, dht_item_lifetime, dht_sample_infohashes_interval, dht_max_infohashes_sample_count, max_piece_count, metadata_token_limit, disk_write_mode, mmap_file_size_cutoff, i2p_inbound_quantity, i2p_outbound_quantity, i2p_inbound_length, i2p_outbound_length, min_websocket_announce_interval, webtorrent_connection_timeout, max_int_setting_internal };
private static int_types[] swigValues = { tracker_completion_timeout, tracker_receive_timeout, stop_tracker_timeout, tracker_maximum_response_length, piece_timeout, request_timeout, request_queue_time, max_allowed_in_request_queue, max_out_request_queue, whole_pieces_threshold, peer_timeout, urlseed_timeout, urlseed_pipeline_size, urlseed_wait_retry, file_pool_size, max_failcount, min_reconnect_time, peer_connect_timeout, connection_speed, inactivity_timeout, unchoke_interval, optimistic_unchoke_interval, num_want, initial_picker_threshold, allowed_fast_set_size, suggest_mode, max_queued_disk_bytes, handshake_timeout, send_buffer_low_watermark, send_buffer_watermark, send_buffer_watermark_factor, choking_algorithm, seed_choking_algorithm, disk_io_write_mode, disk_io_read_mode, outgoing_port, num_outgoing_ports, peer_dscp, active_downloads, active_seeds, active_checking, active_dht_limit, active_tracker_limit, active_lsd_limit, active_limit, auto_manage_interval, seed_time_limit, auto_scrape_interval, auto_scrape_min_interval, max_peerlist_size, max_paused_peerlist_size, min_announce_interval, auto_manage_startup, seeding_piece_quota, max_rejects, recv_socket_buffer_size, send_socket_buffer_size, max_peer_recv_buffer_size, optimistic_disk_retry, max_suggest_pieces, local_service_announce_interval, dht_announce_interval, udp_tracker_token_expiry, num_optimistic_unchoke_slots, max_pex_peers, tick_interval, share_mode_target, upload_rate_limit, download_rate_limit, dht_upload_rate_limit, unchoke_slots_limit, connections_limit, connections_slack, utp_target_delay, utp_gain_factor, utp_min_timeout, utp_syn_resends, utp_fin_resends, utp_num_resends, utp_connect_timeout, utp_loss_multiplier, mixed_mode_algorithm, listen_queue_size, torrent_connect_boost, alert_queue_size, max_metadata_size, hashing_threads, checking_mem_usage, predictive_piece_announce, aio_threads, tracker_backoff, share_ratio_limit, seed_time_ratio_limit, peer_turnover, peer_turnover_cutoff, peer_turnover_interval, connect_seed_every_n_download, max_http_recv_buffer_size, max_retry_port_bind, alert_mask, out_enc_policy, in_enc_policy, allowed_enc_level, inactive_down_rate, inactive_up_rate, proxy_type, proxy_port, i2p_port, urlseed_max_request_bytes, web_seed_name_lookup_retry, close_file_interval, utp_cwnd_reduce_timer, max_web_seed_connections, resolver_cache_timeout, send_not_sent_low_watermark, rate_choker_initial_threshold, upnp_lease_duration, max_concurrent_http_announces, dht_max_peers_reply, dht_search_branching, dht_max_fail_count, dht_max_torrents, dht_max_dht_items, dht_max_peers, dht_max_torrent_search_reply, dht_block_timeout, dht_block_ratelimit, dht_item_lifetime, dht_sample_infohashes_interval, dht_max_infohashes_sample_count, max_piece_count, metadata_token_limit, disk_write_mode, mmap_file_size_cutoff, i2p_inbound_quantity, i2p_outbound_quantity, i2p_inbound_length, i2p_outbound_length, announce_port, min_websocket_announce_interval, webtorrent_connection_timeout, max_int_setting_internal };
private static int swigNext = 0;
private final int swigValue;
private final String swigName;
Expand Down
13 changes: 12 additions & 1 deletion src/test/java/org/libtorrent4j/SettingsPackTest.java
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2020-2022, Alden Torres
* Copyright (c) 2020-2024, Alden Torres
*
* Licensed under the terms of the MIT license.
* Copy of the license at https://opensource.org/licenses/MIT
Expand Down Expand Up @@ -63,4 +63,15 @@ public void testMaxMetadataSize() {

assertEquals(1, settings.getMaxMetadataSize());
}

@Test
public void testAnnouncePort() {
SettingsPack settings = SettingsPack.defaultSettings();

assertEquals(0, settings.getAnnouncePort());

settings.setAnnouncePort(1);

assertEquals(1, settings.getAnnouncePort());
}
}

0 comments on commit 0245a7b

Please sign in to comment.