From 8dacabc6c15747e9124a474324ca357535ca2629 Mon Sep 17 00:00:00 2001 From: sledgehammer_999 Date: Tue, 5 Dec 2017 00:10:47 +0200 Subject: [PATCH 1/8] Fix mailing list archives link. Closes #2588. --- docs/index.rst | 2 +- docs/template.txt | 2 +- docs/template2.txt | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/docs/index.rst b/docs/index.rst index ee8277d48..b80f41637 100644 --- a/docs/index.rst +++ b/docs/index.rst @@ -81,7 +81,7 @@ libtorrent .. _`HTTP seed`: http://www.getright.com/seedtorrent.html .. _multitracker: http://bittorrent.org/beps/bep_0012.html .. _mailing list: http://lists.sourceforge.net/lists/listinfo/libtorrent-discuss -.. _archive: http://dir.gmane.org/gmane.network.bit-torrent.libtorrent +.. _archive: https://sourceforge.net/p/libtorrent/mailman/libtorrent-discuss/ .. _`who's using libtorrent?`: projects.html .. _`report bugs`: https://github.com/arvidn/libtorrent/issues .. _`github page`: https://github.com/arvidn/libtorrent diff --git a/docs/template.txt b/docs/template.txt index 92f2304c7..1cc78b5af 100644 --- a/docs/template.txt +++ b/docs/template.txt @@ -51,7 +51,7 @@ DHT security extension - mailing list archive + mailing list archive contributing streaming diff --git a/docs/template2.txt b/docs/template2.txt index e642ddb17..7b4687f89 100644 --- a/docs/template2.txt +++ b/docs/template2.txt @@ -62,7 +62,7 @@ DHT security extension - mailing list archive + mailing list archive contributing streaming From 83e71e16d80f513f7ce383a3e0a517e70baf6f63 Mon Sep 17 00:00:00 2001 From: arvidn Date: Wed, 6 Dec 2017 10:01:04 +0100 Subject: [PATCH 2/8] use total transfer rates consistently for session and torrents in client_test --- examples/session_view.cpp | 12 ++++++------ examples/session_view.hpp | 4 ++-- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/examples/session_view.cpp b/examples/session_view.cpp index 2cfc10df6..aebb1110f 100644 --- a/examples/session_view.cpp +++ b/examples/session_view.cpp @@ -55,8 +55,8 @@ session_view::session_view() m_wasted_bytes_idx = find_metric_idx("net.recv_redundant_bytes"); m_failed_bytes_idx = find_metric_idx("net.recv_failed_bytes"); m_num_peers_idx = find_metric_idx("peer.num_peers_connected"); - m_recv_payload_idx = find_metric_idx("net.recv_payload_bytes"); - m_sent_payload_idx = find_metric_idx("net.sent_payload_bytes"); + m_recv_idx = find_metric_idx("net.recv_bytes"); + m_sent_idx = find_metric_idx("net.sent_bytes"); m_unchoked_idx = find_metric_idx("peer.num_peers_up_unchoked"); m_unchoke_slots_idx = find_metric_idx("ses.num_unchoke_slots"); m_limiter_up_queue_idx = find_metric_idx("net.limiter_up_queue"); @@ -106,9 +106,9 @@ void session_view::render() float seconds = (m_timestamp[0] - m_timestamp[1]) / 1000000.f; - int download_rate = (m_cnt[0][m_recv_payload_idx] - m_cnt[1][m_recv_payload_idx]) + int download_rate = (m_cnt[0][m_recv_idx] - m_cnt[1][m_recv_idx]) / seconds; - int upload_rate = (m_cnt[0][m_sent_payload_idx] - m_cnt[1][m_sent_payload_idx]) + int upload_rate = (m_cnt[0][m_sent_idx] - m_cnt[1][m_sent_idx]) / seconds; pos += snprintf(str, sizeof(str), "%s%s fail: %s down: %s (%s) " @@ -118,7 +118,7 @@ void session_view::render() , esc("1") , add_suffix(m_cnt[0][m_failed_bytes_idx]).c_str() , color(add_suffix(download_rate, "/s"), col_green).c_str() - , color(add_suffix(m_cnt[0][m_recv_payload_idx]), col_green).c_str() + , color(add_suffix(m_cnt[0][m_recv_idx]), col_green).c_str() , color(to_string(m_cnt[0][m_limiter_up_queue_idx], 3), col_red).c_str() , color(to_string(m_cnt[0][m_limiter_down_queue_idx], 3), col_green).c_str() , int(m_cnt[0][m_num_peers_idx]) @@ -140,7 +140,7 @@ void session_view::render() , esc("1") , add_suffix(m_cnt[0][m_wasted_bytes_idx]).c_str() , color(add_suffix(upload_rate, "/s"), col_red).c_str() - , color(add_suffix(m_cnt[0][m_sent_payload_idx]), col_red).c_str() + , color(add_suffix(m_cnt[0][m_sent_idx]), col_red).c_str() , color(to_string(m_cnt[0][m_queued_reads_idx], 3), col_red).c_str() , color(to_string(m_cnt[0][m_queued_writes_idx], 3), col_green).c_str() , int((m_cnt[0][m_blocks_written_idx] - m_cnt[0][m_write_ops_idx]) * 100 diff --git a/examples/session_view.hpp b/examples/session_view.hpp index e7a7484fe..d565070ef 100644 --- a/examples/session_view.hpp +++ b/examples/session_view.hpp @@ -73,8 +73,8 @@ private: int m_wasted_bytes_idx; int m_failed_bytes_idx; int m_num_peers_idx; - int m_recv_payload_idx; - int m_sent_payload_idx; + int m_recv_idx; + int m_sent_idx; int m_unchoked_idx; int m_unchoke_slots_idx; int m_limiter_up_queue_idx; From a286b9da47d6c6dfc222d9bd17db8aa1807bb56a Mon Sep 17 00:00:00 2001 From: arvidn Date: Mon, 27 Nov 2017 10:10:45 +0100 Subject: [PATCH 3/8] fix i2p support --- ChangeLog | 1 + src/http_connection.cpp | 11 ++++++----- 2 files changed, 7 insertions(+), 5 deletions(-) diff --git a/ChangeLog b/ChangeLog index ae623cc4c..cb7f68bc2 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,4 +1,5 @@ + * fix i2p support * fix loading resume data when in seed mode * fix part-file creation race condition * fix issue with initializing settings on session construction diff --git a/src/http_connection.cpp b/src/http_connection.cpp index f94e169ab..113b076f7 100644 --- a/src/http_connection.cpp +++ b/src/http_connection.cpp @@ -495,11 +495,10 @@ void http_connection::connect_i2p_tracker(char const* destination) { #ifdef TORRENT_USE_OPENSSL TORRENT_ASSERT(m_ssl == false); - TORRENT_ASSERT(m_sock.get()); - TORRENT_ASSERT(m_sock.get()->get()); - m_sock.get()->get()->set_destination(destination); - m_sock.get()->get()->set_command(i2p_stream::cmd_connect); - m_sock.get()->get()->set_session_id(m_i2p_conn->session_id()); + TORRENT_ASSERT(m_sock.get()); + m_sock.get()->set_destination(destination); + m_sock.get()->set_command(i2p_stream::cmd_connect); + m_sock.get()->set_session_id(m_i2p_conn->session_id()); #else m_sock.get()->set_destination(destination); m_sock.get()->set_command(i2p_stream::cmd_connect); @@ -508,6 +507,8 @@ void http_connection::connect_i2p_tracker(char const* destination) #if defined TORRENT_ASIO_DEBUGGING add_outstanding_async("http_connection::on_connect"); #endif + TORRENT_ASSERT(!m_connecting); + m_connecting = true; m_sock.async_connect(tcp::endpoint(), boost::bind(&http_connection::on_connect , shared_from_this(), _1)); } From b00b3184c09873150bc723a08f580f5024d63418 Mon Sep 17 00:00:00 2001 From: arvidn Date: Sat, 2 Dec 2017 19:33:56 +0100 Subject: [PATCH 4/8] some minor i2p cleanups --- .../libtorrent/http_tracker_connection.hpp | 3 -- include/libtorrent/i2p_stream.hpp | 4 +- src/http_connection.cpp | 39 +++++++------------ src/http_tracker_connection.cpp | 9 ++--- src/i2p_stream.cpp | 6 ++- src/torrent.cpp | 4 +- src/tracker_manager.cpp | 4 +- test/test_privacy.cpp | 16 +++++--- test/test_tracker.cpp | 1 + 9 files changed, 39 insertions(+), 47 deletions(-) diff --git a/include/libtorrent/http_tracker_connection.hpp b/include/libtorrent/http_tracker_connection.hpp index 7abf1ed06..28de15d7e 100644 --- a/include/libtorrent/http_tracker_connection.hpp +++ b/include/libtorrent/http_tracker_connection.hpp @@ -93,9 +93,6 @@ namespace libtorrent tracker_manager& m_man; boost::shared_ptr m_tracker_connection; address m_tracker_ip; -#if TORRENT_USE_I2P - i2p_connection* m_i2p_conn; -#endif }; TORRENT_EXTRA_EXPORT tracker_response parse_tracker_response( diff --git a/include/libtorrent/i2p_stream.hpp b/include/libtorrent/i2p_stream.hpp index a680dafab..9e74c2f64 100644 --- a/include/libtorrent/i2p_stream.hpp +++ b/include/libtorrent/i2p_stream.hpp @@ -149,7 +149,7 @@ private: // send and receive buffer std::vector m_buffer; char const* m_id; - int m_command; // 0 = connect, 1 = accept + command_t m_command; std::string m_dest; std::string m_name_lookup; @@ -162,7 +162,7 @@ private: read_name_lookup_response }; - int m_state; + state_t m_state; #if TORRENT_USE_ASSERTS int m_magic; #endif diff --git a/src/http_connection.cpp b/src/http_connection.cpp index 113b076f7..a099973f9 100644 --- a/src/http_connection.cpp +++ b/src/http_connection.cpp @@ -284,9 +284,12 @@ void http_connection::start(std::string const& hostname, int port error_code err; if (m_sock.is_open()) m_sock.close(err); + aux::proxy_settings const* proxy = ps; + #if TORRENT_USE_I2P bool is_i2p = false; char const* top_domain = strrchr(hostname.c_str(), '.'); + aux::proxy_settings i2p_proxy; if (top_domain && strcmp(top_domain, ".i2p") == 0 && i2p_conn) { // this is an i2p name, we need to use the sam connection @@ -297,23 +300,14 @@ void http_connection::start(std::string const& hostname, int port // because i2p is sloooooow m_completion_timeout *= 4; m_read_timeout *= 4; - } -#endif -#if TORRENT_USE_I2P - if (is_i2p && i2p_conn->proxy().type != settings_pack::i2p_proxy) - { - m_timer.get_io_service().post(boost::bind(&http_connection::callback - , me, error_code(errors::no_i2p_router), static_cast(NULL), 0)); - return; - } -#endif + if (i2p_conn->proxy().type != settings_pack::i2p_proxy) + { + m_timer.get_io_service().post(boost::bind(&http_connection::callback + , me, error_code(errors::no_i2p_router), static_cast(NULL), 0)); + return; + } - aux::proxy_settings const* proxy = ps; -#if TORRENT_USE_I2P - aux::proxy_settings i2p_proxy; - if (is_i2p) - { i2p_proxy = i2p_conn->proxy(); proxy = &i2p_proxy; } @@ -493,17 +487,13 @@ void http_connection::close(bool force) #if TORRENT_USE_I2P void http_connection::connect_i2p_tracker(char const* destination) { + TORRENT_ASSERT(m_sock.get()); #ifdef TORRENT_USE_OPENSSL TORRENT_ASSERT(m_ssl == false); - TORRENT_ASSERT(m_sock.get()); - m_sock.get()->set_destination(destination); - m_sock.get()->set_command(i2p_stream::cmd_connect); - m_sock.get()->set_session_id(m_i2p_conn->session_id()); -#else - m_sock.get()->set_destination(destination); - m_sock.get()->set_command(i2p_stream::cmd_connect); - m_sock.get()->set_session_id(m_i2p_conn->session_id()); #endif + m_sock.get()->set_destination(destination); + m_sock.get()->set_command(i2p_stream::cmd_connect); + m_sock.get()->set_session_id(m_i2p_conn->session_id()); #if defined TORRENT_ASIO_DEBUGGING add_outstanding_async("http_connection::on_connect"); #endif @@ -513,8 +503,7 @@ void http_connection::connect_i2p_tracker(char const* destination) , shared_from_this(), _1)); } -void http_connection::on_i2p_resolve(error_code const& e - , char const* destination) +void http_connection::on_i2p_resolve(error_code const& e, char const* destination) { #if defined TORRENT_ASIO_DEBUGGING complete_async("http_connection::on_i2p_resolve"); diff --git a/src/http_tracker_connection.cpp b/src/http_tracker_connection.cpp index e255039d6..331e750a7 100644 --- a/src/http_tracker_connection.cpp +++ b/src/http_tracker_connection.cpp @@ -70,9 +70,6 @@ namespace libtorrent , boost::weak_ptr c) : tracker_connection(man, req, ios, c) , m_man(man) -#if TORRENT_USE_I2P - , m_i2p_conn(NULL) -#endif {} void http_tracker_connection::start() @@ -94,7 +91,7 @@ namespace libtorrent } #if TORRENT_USE_I2P - bool i2p = is_i2p_url(url); + bool const i2p = is_i2p_url(url); #else static const bool i2p = false; #endif @@ -425,7 +422,7 @@ namespace libtorrent } tracker_response parse_tracker_response(char const* data, int size, error_code& ec - , int flags, sha1_hash scrape_ih) + , int const flags, sha1_hash scrape_ih) { tracker_response resp; @@ -443,7 +440,7 @@ namespace libtorrent int interval = int(e.dict_find_int_value("interval", 0)); // if no interval is specified, default to 30 minutes if (interval == 0) interval = 1800; - int min_interval = int(e.dict_find_int_value("min interval", 30)); + int const min_interval = int(e.dict_find_int_value("min interval", 30)); resp.interval = interval; resp.min_interval = min_interval; diff --git a/src/i2p_stream.cpp b/src/i2p_stream.cpp index cb0e736a9..e31c155c6 100644 --- a/src/i2p_stream.cpp +++ b/src/i2p_stream.cpp @@ -225,7 +225,7 @@ namespace libtorrent : proxy_base(io_service) , m_id(0) , m_command(cmd_create_session) - , m_state(0) + , m_state(read_hello_response) { #if TORRENT_USE_ASSERTS m_magic = 0x1337; @@ -446,7 +446,9 @@ namespace libtorrent case cmd_connect: send_connect(h); break; - default: + case cmd_none: + case cmd_name_lookup: + case cmd_incoming: (*h)(e); std::vector().swap(m_buffer); } diff --git a/src/torrent.cpp b/src/torrent.cpp index 82cef522c..2b6bae744 100644 --- a/src/torrent.cpp +++ b/src/torrent.cpp @@ -3312,7 +3312,7 @@ namespace { #endif req.key = tracker_key(); -#ifdef TORRENT_USE_OPENSSL +#if TORRENT_USE_I2P if (is_i2p()) { req.kind |= tracker_request::i2p; @@ -7441,8 +7441,10 @@ namespace { error_code ec; torrent_peer const* p = *i; address addr = p->address(); +#if TORRENT_USE_I2P if (p->is_i2p_addr) continue; +#endif if (p->banned) { #if TORRENT_USE_IPV6 diff --git a/src/tracker_manager.cpp b/src/tracker_manager.cpp index e999452e0..e2916a9bf 100644 --- a/src/tracker_manager.cpp +++ b/src/tracker_manager.cpp @@ -171,8 +171,8 @@ namespace libtorrent , char const* msg, int interval, int min_interval) { // we need to post the error to avoid deadlock - get_io_service().post(boost::bind(&tracker_connection::fail_impl - , shared_from_this(), ec, code, std::string(msg), interval, min_interval)); + get_io_service().post(boost::bind(&tracker_connection::fail_impl + , shared_from_this(), ec, code, std::string(msg), interval, min_interval)); } void tracker_connection::fail_impl(error_code const& ec, int code diff --git a/test/test_privacy.cpp b/test/test_privacy.cpp index cac98752c..0a0b1eefa 100644 --- a/test/test_privacy.cpp +++ b/test/test_privacy.cpp @@ -91,12 +91,12 @@ session_proxy test_proxy(settings_pack::proxy_type_t proxy_type, int flags) flags &= ~expect_dht_msg; #endif fprintf(stderr, "\n=== TEST == proxy: %s anonymous-mode: %s\n\n", proxy_name[proxy_type], (flags & force_proxy_mode) ? "yes" : "no"); - int http_port = start_web_server(); - int udp_port = start_udp_tracker(); - int dht_port = start_dht(); - int peer_port = start_peer(); + int const http_port = start_web_server(); + int const udp_port = start_udp_tracker(); + int const dht_port = start_dht(); + int const peer_port = start_peer(); - int prev_udp_announces = num_udp_announces(); + int const prev_udp_announces = num_udp_announces(); int const alert_mask = alert::all_categories & ~alert::progress_notification @@ -131,7 +131,7 @@ session_proxy test_proxy(settings_pack::proxy_type_t proxy_type, int flags) // in non-anonymous mode we circumvent/ignore the proxy if it fails // wheras in anonymous mode, we just fail sett.set_str(settings_pack::proxy_hostname, "non-existing.com"); - sett.set_int(settings_pack::proxy_type, (settings_pack::proxy_type_t)proxy_type); + sett.set_int(settings_pack::proxy_type, proxy_type); sett.set_int(settings_pack::proxy_port, 4444); lt::session* s = new lt::session(sett); @@ -276,10 +276,12 @@ TORRENT_TEST(http_pt) test_proxy(settings_pack::http_pw, expect_udp_connection | expect_dht_msg); } +#if TORRENT_USE_I2P TORRENT_TEST(i2p) { test_proxy(settings_pack::i2p_proxy, expect_udp_connection | expect_dht_msg); } +#endif // using anonymous mode @@ -317,8 +319,10 @@ TORRENT_TEST(anon_http_pw) test_proxy(settings_pack::http_pw, force_proxy_mode | expect_udp_reject); } +#if TORRENT_USE_I2P TORRENT_TEST(anon_i2p) { test_proxy(settings_pack::i2p_proxy, force_proxy_mode); } +#endif diff --git a/test/test_tracker.cpp b/test/test_tracker.cpp index c651fabb1..9f8e43ba1 100644 --- a/test/test_tracker.cpp +++ b/test/test_tracker.cpp @@ -46,6 +46,7 @@ POSSIBILITY OF SUCH DAMAGE. #include "libtorrent/announce_entry.hpp" #include +#include using namespace libtorrent; namespace lt = libtorrent; From 34fc3d0f18303e277f802c66c9eddadf5f1a7dc1 Mon Sep 17 00:00:00 2001 From: arvidn Date: Sun, 10 Dec 2017 22:46:08 +0100 Subject: [PATCH 5/8] extend clean script --- tools/clean.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/tools/clean.py b/tools/clean.py index 7565978fc..4d97c51b4 100755 --- a/tools/clean.py +++ b/tools/clean.py @@ -40,6 +40,7 @@ def clean(): '.', 'tools', 'src', + 'simulation', os.path.join('src', 'kademlia'), os.path.join('include', 'libtorrent'), os.path.join('include', os.path.join('libtorrent', '_aux')), @@ -47,7 +48,8 @@ def clean(): os.path.join('bindings', 'python'), os.path.join('bindings', os.path.join('python', 'src')), os.path.join('bindings', 'c'), - os.path.join('bindings', os.path.join('c', 'src')) + os.path.join('bindings', os.path.join('c', 'src')), + os.path.join('simulation', 'libsimulator') ] for d in directories: From fe6473039ca0b796f31b5c0f30e04d60e5d78cd7 Mon Sep 17 00:00:00 2001 From: arvidn Date: Fri, 8 Dec 2017 09:49:33 +0100 Subject: [PATCH 6/8] fix rate limit utp feature --- src/session_impl.cpp | 16 ++++------------ test/test_auto_unchoke.cpp | 3 +++ test/test_fast_extension.cpp | 3 +++ test/test_lsd.cpp | 3 +++ test/test_pex.cpp | 3 +++ test/test_priority.cpp | 3 +++ test/test_transfer.cpp | 3 +++ 7 files changed, 22 insertions(+), 12 deletions(-) diff --git a/src/session_impl.cpp b/src/session_impl.cpp index 8a4f161a7..043d791fe 100644 --- a/src/session_impl.cpp +++ b/src/session_impl.cpp @@ -6649,25 +6649,17 @@ retry: if (m_settings.get_bool(settings_pack::rate_limit_utp)) { // allow the global or local peer class to limit uTP peers - m_peer_class_type_filter.add(peer_class_type_filter::utp_socket - , m_local_peer_class); - m_peer_class_type_filter.add(peer_class_type_filter::utp_socket + m_peer_class_type_filter.allow(peer_class_type_filter::utp_socket , m_global_class); - m_peer_class_type_filter.add(peer_class_type_filter::ssl_utp_socket - , m_local_peer_class); - m_peer_class_type_filter.add(peer_class_type_filter::ssl_utp_socket + m_peer_class_type_filter.allow(peer_class_type_filter::ssl_utp_socket , m_global_class); } else { // don't add the global or local peer class to limit uTP peers - m_peer_class_type_filter.remove(peer_class_type_filter::utp_socket - , m_local_peer_class); - m_peer_class_type_filter.remove(peer_class_type_filter::utp_socket + m_peer_class_type_filter.disallow(peer_class_type_filter::utp_socket , m_global_class); - m_peer_class_type_filter.remove(peer_class_type_filter::ssl_utp_socket - , m_local_peer_class); - m_peer_class_type_filter.remove(peer_class_type_filter::ssl_utp_socket + m_peer_class_type_filter.disallow(peer_class_type_filter::ssl_utp_socket , m_global_class); } } diff --git a/test/test_auto_unchoke.cpp b/test/test_auto_unchoke.cpp index 0077f195f..0840a4211 100644 --- a/test/test_auto_unchoke.cpp +++ b/test/test_auto_unchoke.cpp @@ -74,6 +74,9 @@ void test_swarm() pack.set_bool(settings_pack::enable_natpmp, false); pack.set_bool(settings_pack::enable_upnp, false); pack.set_bool(settings_pack::enable_dht, false); +#ifndef TORRENT_NO_DEPRECATE + pack.set_bool(settings_pack::rate_limit_utp, true); +#endif pack.set_int(settings_pack::out_enc_policy, settings_pack::pe_forced); pack.set_int(settings_pack::in_enc_policy, settings_pack::pe_forced); diff --git a/test/test_fast_extension.cpp b/test/test_fast_extension.cpp index ce12643a9..d8ac598bc 100644 --- a/test/test_fast_extension.cpp +++ b/test/test_fast_extension.cpp @@ -424,6 +424,9 @@ boost::shared_ptr setup_peer(tcp::socket& s, sha1_hash& ih sett.set_int(settings_pack::out_enc_policy, settings_pack::pe_disabled); sett.set_bool(settings_pack::enable_outgoing_utp, false); sett.set_bool(settings_pack::enable_incoming_utp, false); +#ifndef TORRENT_NO_DEPRECATE + sett.set_bool(settings_pack::rate_limit_utp, true); +#endif ses.reset(new lt::session(sett, lt::session::add_default_plugins)); error_code ec; diff --git a/test/test_lsd.cpp b/test/test_lsd.cpp index f550aec6f..f9de07549 100644 --- a/test/test_lsd.cpp +++ b/test/test_lsd.cpp @@ -59,6 +59,9 @@ void test_lsd() pack.set_bool(settings_pack::enable_upnp, false); pack.set_bool(settings_pack::enable_natpmp, false); pack.set_str(settings_pack::listen_interfaces, "127.0.0.1:48100"); +#ifndef TORRENT_NO_DEPRECATE + pack.set_bool(settings_pack::rate_limit_utp, true); +#endif lt::session ses1(pack); diff --git a/test/test_pex.cpp b/test/test_pex.cpp index 2b305f926..9c9da8f40 100644 --- a/test/test_pex.cpp +++ b/test/test_pex.cpp @@ -76,6 +76,9 @@ void test_pex() pack.set_bool(settings_pack::enable_dht, false); pack.set_bool(settings_pack::enable_upnp, false); pack.set_bool(settings_pack::enable_natpmp, false); +#ifndef TORRENT_NO_DEPRECATE + pack.set_bool(settings_pack::rate_limit_utp, true); +#endif pack.set_int(settings_pack::out_enc_policy, settings_pack::pe_forced); pack.set_int(settings_pack::in_enc_policy, settings_pack::pe_forced); diff --git a/test/test_priority.cpp b/test/test_priority.cpp index 06366a6ed..2850301d1 100644 --- a/test/test_priority.cpp +++ b/test/test_priority.cpp @@ -106,6 +106,9 @@ void test_transfer(settings_pack const& sett) pack.set_str(settings_pack::listen_interfaces, "0.0.0.0:48075"); pack.set_int(settings_pack::alert_mask, mask); +#ifndef TORRENT_NO_DEPRECATE + pack.set_bool(settings_pack::rate_limit_utp, true); +#endif lt::session ses1(pack); diff --git a/test/test_transfer.cpp b/test/test_transfer.cpp index 9a3bdd9f7..d1cef7c9c 100644 --- a/test/test_transfer.cpp +++ b/test/test_transfer.cpp @@ -153,6 +153,9 @@ void test_transfer(int proxy_type, settings_pack const& sett pack.set_bool(settings_pack::enable_natpmp, false); pack.set_bool(settings_pack::enable_lsd, false); pack.set_bool(settings_pack::enable_dht, false); +#ifndef TORRENT_NO_DEPRECATE + pack.set_bool(settings_pack::rate_limit_utp, true); +#endif lt::session ses1(pack); From 3167b68e9889e9da92fb9531eca3799b492b8659 Mon Sep 17 00:00:00 2001 From: arvidn Date: Sat, 9 Dec 2017 23:16:27 +0100 Subject: [PATCH 7/8] shorter test timeouts --- appveyor.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/appveyor.yml b/appveyor.yml index 6077c6ccd..8da11c667 100644 --- a/appveyor.yml +++ b/appveyor.yml @@ -123,9 +123,9 @@ build_script: test_script: - cd %ROOT_DIRECTORY%\test - if defined x64 ( - appveyor-retry b2.exe -l1800 --hash -j2 openssl-version=pre1.1 address-model=64 win-tests %compiler% variant=%variant% link=shared + appveyor-retry b2.exe -l400 --hash -j2 openssl-version=pre1.1 address-model=64 win-tests %compiler% variant=%variant% link=shared ) else ( - appveyor-retry b2.exe -l1800 --hash -j2 openssl-version=pre1.1 address-model=32 win-tests %compiler% variant=%variant% link=shared + appveyor-retry b2.exe -l400 --hash -j2 openssl-version=pre1.1 address-model=32 win-tests %compiler% variant=%variant% link=shared ) - if defined sim ( cd %ROOT_DIRECTORY%\simulation From 86c83fe9765e191e5aadab5098b40fa1781bbd33 Mon Sep 17 00:00:00 2001 From: arvidn Date: Mon, 11 Dec 2017 14:37:19 +0100 Subject: [PATCH 8/8] fix asio debugging --- src/session.cpp | 56 +++++++++++++++++++++++++++++++------------------ 1 file changed, 36 insertions(+), 20 deletions(-) diff --git a/src/session.cpp b/src/session.cpp index ee565bb00..c9760f8ae 100644 --- a/src/session.cpp +++ b/src/session.cpp @@ -83,6 +83,32 @@ using libtorrent::aux::session_impl; namespace libtorrent { +namespace { + +#if defined TORRENT_ASIO_DEBUGGING + void wait_for_asio_handlers() + { + int counter = 0; + while (log_async()) + { +#if defined TORRENT_WINDOWS || defined TORRENT_CYGWIN + Sleep(1000); +#elif defined TORRENT_BEOS + snooze_until(system_time() + 1000000, B_SYSTEM_TIMEBASE); +#else + usleep(1000000); +#endif + ++counter; + printf("\x1b[2J\x1b[0;0H\x1b[33m==== Waiting to shut down: %d ==== \x1b[0m\n\n" + , counter); + } + async_dec_threads(); + + fprintf(stderr, "\n\nEXPECTS NO MORE ASYNC OPS\n\n\n"); + } +#endif +} // anonymous namespace + TORRENT_EXPORT void min_memory_usage(settings_pack& set) { // receive data directly into disk buffers @@ -378,28 +404,13 @@ namespace libtorrent TORRENT_ASSERT(m_impl); TORRENT_ASYNC_CALL(abort); -#if defined TORRENT_ASIO_DEBUGGING - int counter = 0; - while (log_async()) - { -#if defined TORRENT_WINDOWS || defined TORRENT_CYGWIN - Sleep(1000); -#elif defined TORRENT_BEOS - snooze_until(system_time() + 1000000, B_SYSTEM_TIMEBASE); -#else - usleep(1000000); -#endif - ++counter; - printf("\x1b[2J\x1b[0;0H\x1b[33m==== Waiting to shut down: %d ==== \x1b[0m\n\n" - , counter); - } - async_dec_threads(); - - fprintf(stderr, "\n\nEXPECTS NO MORE ASYNC OPS\n\n\n"); -#endif - if (m_thread && m_thread.unique()) + { +#if defined TORRENT_ASIO_DEBUGGING + wait_for_asio_handlers(); +#endif m_thread->join(); + } } session_proxy session::abort() @@ -424,7 +435,12 @@ namespace libtorrent session_proxy::~session_proxy() { if (m_thread && m_thread.unique()) + { +#if defined TORRENT_ASIO_DEBUGGING + wait_for_asio_handlers(); +#endif m_thread->join(); + } } }