From 044ee0f054b7e86dfa9a93f56bfe51cea3b89489 Mon Sep 17 00:00:00 2001 From: arvidn Date: Fri, 8 Apr 2016 22:42:48 -0400 Subject: [PATCH 1/8] update simulator submodule --- simulation/libsimulator | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/simulation/libsimulator b/simulation/libsimulator index 0151d5c17..5f7cbb8bd 160000 --- a/simulation/libsimulator +++ b/simulation/libsimulator @@ -1 +1 @@ -Subproject commit 0151d5c17fa3f4cf0ce518d0b8f90a23792c9b24 +Subproject commit 5f7cbb8bd222ed0e5cfdaffc2a2f5010fb5b4a29 From 57d619eec728a8e9ddb0b8beec38821d7e46a885 Mon Sep 17 00:00:00 2001 From: arvidn Date: Fri, 8 Apr 2016 22:43:49 -0400 Subject: [PATCH 2/8] update revision --- include/libtorrent/version.hpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/include/libtorrent/version.hpp b/include/libtorrent/version.hpp index a549d95de..3dafe18e1 100644 --- a/include/libtorrent/version.hpp +++ b/include/libtorrent/version.hpp @@ -44,7 +44,7 @@ POSSIBILITY OF SUCH DAMAGE. #define LIBTORRENT_VERSION_NUM ((LIBTORRENT_VERSION_MAJOR * 10000) + (LIBTORRENT_VERSION_MINOR * 100) + LIBTORRENT_VERSION_TINY) #define LIBTORRENT_VERSION "1.1.0.0" -#define LIBTORRENT_REVISION "7f05551" +#define LIBTORRENT_REVISION "044ee0f" namespace libtorrent { From 08edf43b3f04454deb351732ad231395201dbe87 Mon Sep 17 00:00:00 2001 From: arvidn Date: Sat, 9 Apr 2016 00:33:26 -0400 Subject: [PATCH 3/8] fix to documentation generation to exclude private functions. fix makefile errors --- docs/gen_reference_doc.py | 2 ++ include/libtorrent/kademlia/msg.hpp | 4 ++-- test/Makefile.am | 1 + tools/Makefile.am | 1 - 4 files changed, 5 insertions(+), 3 deletions(-) diff --git a/docs/gen_reference_doc.py b/docs/gen_reference_doc.py index 029e95801..de3a40d20 100644 --- a/docs/gen_reference_doc.py +++ b/docs/gen_reference_doc.py @@ -589,6 +589,8 @@ for filename in files: continue if (l == 'namespace detail' or \ + l == 'namespace dht_detail' or \ + l == 'namespace impl' or \ l == 'namespace aux') \ and not internal: lno = consume_block(lno, lines) diff --git a/include/libtorrent/kademlia/msg.hpp b/include/libtorrent/kademlia/msg.hpp index d82b91a47..caa015cac 100644 --- a/include/libtorrent/kademlia/msg.hpp +++ b/include/libtorrent/kademlia/msg.hpp @@ -88,12 +88,12 @@ struct key_desc_t }; // generate an error response message -void TORRENT_EXPORT incoming_error(entry& e, char const* msg, int error_code = 203); +void incoming_error(entry& e, char const* msg, int error_code = 203); // given a redundant name to avoid clashing with libtorrent::detail namespace dht_detail { -bool TORRENT_EXPORT verify_message(bdecode_node const& msg, key_desc_t const desc[] +TORRENT_EXPORT bool verify_message(bdecode_node const& msg, key_desc_t const desc[] , bdecode_node ret[], int size, char* error, int error_size); } diff --git a/test/Makefile.am b/test/Makefile.am index 35b3a3258..c5300cdf2 100644 --- a/test/Makefile.am +++ b/test/Makefile.am @@ -178,6 +178,7 @@ test_lsd_SOURCES = test_lsd.cpp test_pe_crypto_SOURCES = test_pe_crypto.cpp test_pex_SOURCES = test_pex.cpp test_read_piece_SOURCES = test_read_piece.cpp +test_receive_buffer_SOURCES = test_receive_buffer.cpp test_storage_SOURCES = test_storage.cpp test_time_critical_SOURCES = test_time_critical.cpp test_resume_SOURCES = test_resume.cpp diff --git a/tools/Makefile.am b/tools/Makefile.am index 1cf4aee97..074aaa8c1 100644 --- a/tools/Makefile.am +++ b/tools/Makefile.am @@ -12,7 +12,6 @@ EXTRA_DIST = Jamfile \ parse_dht_log.py \ parse_dht_rtt.py \ parse_dht_stats.py \ - parse_access_log.py \ parse_disk_buffer_log.py\ parse_disk_log.py \ parse_memory_log.py \ From 5d499e83b698b3fbf782e97e023fb8ab00ec2aa7 Mon Sep 17 00:00:00 2001 From: arvidn Date: Sat, 9 Apr 2016 10:50:45 -0400 Subject: [PATCH 4/8] fix uTP/SSL --- simulation/libsimulator | 2 +- src/session_impl.cpp | 3 +++ 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/simulation/libsimulator b/simulation/libsimulator index 5f7cbb8bd..0151d5c17 160000 --- a/simulation/libsimulator +++ b/simulation/libsimulator @@ -1 +1 @@ -Subproject commit 5f7cbb8bd222ed0e5cfdaffc2a2f5010fb5b4a29 +Subproject commit 0151d5c17fa3f4cf0ce518d0b8f90a23792c9b24 diff --git a/src/session_impl.cpp b/src/session_impl.cpp index 0fd295b34..259796389 100644 --- a/src/session_impl.cpp +++ b/src/session_impl.cpp @@ -3099,6 +3099,9 @@ retry: m_last_tick = now; m_utp_socket_manager.tick(now); +#ifdef TORRENT_USE_OPENSSL + m_ssl_utp_socket_manager.tick(now); +#endif // only tick the following once per second if (now - m_last_second_tick < seconds(1)) return; From ccc038a7df6b3afbe872ef46c42a285066c1d4c5 Mon Sep 17 00:00:00 2001 From: arvidn Date: Sat, 9 Apr 2016 14:22:05 -0400 Subject: [PATCH 5/8] update libsimulator submodule --- simulation/libsimulator | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/simulation/libsimulator b/simulation/libsimulator index 0151d5c17..5f7cbb8bd 160000 --- a/simulation/libsimulator +++ b/simulation/libsimulator @@ -1 +1 @@ -Subproject commit 0151d5c17fa3f4cf0ce518d0b8f90a23792c9b24 +Subproject commit 5f7cbb8bd222ed0e5cfdaffc2a2f5010fb5b4a29 From 9ffadcde62590b67691b033ff305425731682289 Mon Sep 17 00:00:00 2001 From: Steven Siloti Date: Sat, 9 Apr 2016 16:46:48 -0700 Subject: [PATCH 6/8] allow peers to resume allocating disk buffers when their last outstanding write completes --- src/peer_connection.cpp | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/src/peer_connection.cpp b/src/peer_connection.cpp index 4e4a22097..a4118a8a4 100644 --- a/src/peer_connection.cpp +++ b/src/peer_connection.cpp @@ -2993,6 +2993,15 @@ namespace libtorrent TORRENT_ASSERT(m_outstanding_writing_bytes >= 0); + // every peer is entitled to allocate a disk buffer if it has no writes outstanding + // see the comment in incoming_piece + if (m_outstanding_writing_bytes == 0 + && m_channel_state[download_channel] & peer_info::bw_disk) + { + m_counters.inc_stats_counter(counters::num_peers_down_disk, -1); + m_channel_state[download_channel] &= ~peer_info::bw_disk; + } + // flush send buffer at the end of // this burst of disk events // m_ses.cork_burst(this); From 5ebb7d203bf6e8cdb5037d566176608658539c47 Mon Sep 17 00:00:00 2001 From: arvidn Date: Sun, 10 Apr 2016 15:10:29 -0400 Subject: [PATCH 7/8] Makefile fix --- test/Makefile.am | 67 ++++++++++++++++++++------------------ test/test_coverage_win.bat | 19 ----------- 2 files changed, 36 insertions(+), 50 deletions(-) delete mode 100644 test/test_coverage_win.bat diff --git a/test/Makefile.am b/test/Makefile.am index c5300cdf2..442c44b3e 100644 --- a/test/Makefile.am +++ b/test/Makefile.am @@ -45,48 +45,53 @@ endif TESTS = $(test_programs) EXTRA_DIST = Jamfile \ + test_torrents/backslash_path.torrent \ test_torrents/base.torrent \ - test_torrents/parent_path.torrent \ + test_torrents/creation_date.torrent \ + test_torrents/duplicate_files.torrent \ + test_torrents/duplicate_web_seeds.torrent \ + test_torrents/empty_httpseed.torrent \ + test_torrents/empty_path.torrent \ + test_torrents/empty_path_multi.torrent \ test_torrents/hidden_parent_path.torrent \ + test_torrents/httpseed.torrent \ + test_torrents/invalid_file_size.torrent \ + test_torrents/invalid_info.torrent \ + test_torrents/invalid_name.torrent \ + test_torrents/invalid_name2.torrent \ + test_torrents/invalid_name3.torrent \ + test_torrents/invalid_path_list.torrent \ + test_torrents/invalid_piece_len.torrent \ + test_torrents/invalid_pieces.torrent \ + test_torrents/invalid_root_hash.torrent \ + test_torrents/invalid_root_hash2.torrent \ + test_torrents/long_name.torrent \ + test_torrents/missing_path_list.torrent \ + test_torrents/missing_piece_len.torrent \ + test_torrents/negative_file_size.torrent \ + test_torrents/negative_piece_len.torrent \ + test_torrents/negative_size.torrent \ + test_torrents/no_creation_date.torrent \ + test_torrents/no_name.torrent \ + test_torrents/pad_file.torrent \ + test_torrents/parent_path.torrent \ + test_torrents/root_hash.torrent \ + test_torrents/sample.torrent \ test_torrents/single_multi_file.torrent \ test_torrents/slash_path.torrent \ - test_torrents/backslash_path.torrent \ + test_torrents/slash_path2.torrent \ + test_torrents/slash_path3.torrent \ + test_torrents/string.torrent \ + test_torrents/symlink1.torrent \ + test_torrents/unaligned_pieces.torrent \ test_torrents/url_list.torrent \ test_torrents/url_list2.torrent \ test_torrents/url_list3.torrent \ - test_torrents/httpseed.torrent \ - test_torrents/empty_httpseed.torrent \ - test_torrents/long_name.torrent \ - test_torrents/whitespace_url.torrent \ - test_torrents/duplicate_files.torrent \ - test_torrents/invalid_piece_len.torrent \ - test_torrents/missing_piece_len.torrent \ - test_torrents/negative_piece_len.torrent \ - test_torrents/no_name.torrent \ - test_torrents/invalid_name.torrent \ - test_torrents/invalid_name2.torrent \ - test_torrents/invalid_info.torrent \ - test_torrents/string.torrent \ - test_torrents/negative_size.torrent \ - test_torrents/negative_file_size.torrent \ - test_torrents/pad_file.torrent \ - test_torrents/invalid_path_list.torrent \ - test_torrents/missing_path_list.torrent \ - test_torrents/invalid_pieces.torrent \ - test_torrents/unaligned_pieces.torrent \ - test_torrents/creation_date.torrent \ - test_torrents/no_creation_date.torrent \ test_torrents/url_seed.torrent \ test_torrents/url_seed_multi.torrent \ test_torrents/url_seed_multi_space.torrent \ test_torrents/url_seed_multi_space_nolist.torrent \ - test_torrents/invalid_root_hash.torrent \ - test_torrents/invalid_root_hash2.torrent \ - test_torrents/root_hash.torrent \ - test_torrents/invalid_file_size.torrent \ - test_torrents/empty_path_multi.torrent \ - test_torrents/duplicate_web_seeds.torrent \ - test_torrents/sample.torrent \ + test_torrents/whitespace_url.torrent \ mutable_test_torrents/test1.torrent \ mutable_test_torrents/test1_pad_files.torrent \ mutable_test_torrents/test1_single.torrent\ diff --git a/test/test_coverage_win.bat b/test/test_coverage_win.bat deleted file mode 100644 index bb4ed1521..000000000 --- a/test/test_coverage_win.bat +++ /dev/null @@ -1,19 +0,0 @@ -REM this is just to get libtorrent built -bjam -j8 msvc-12.0 invariant-checks=off asserts=off link=shared boost-link=shared test_primitives linkflags=/profile deprecated-functions=off - -Vsinstr -coverage ..\bin\msvc-12.0\debug\asserts-off\boost-link-shared\boost-source\debug-iterators-on\deprecated-functions-off\export-extra-on\invariant-checks-off\threading-multi\torrent.dll @vsinstr_excludes.rsp - -REM prepare for running all the tests again -del /s /q bin -del /q test.coverage - -REM add vsperfmon to the path -set path=%path%;c:\Program Files (x86)\Microsoft Visual Studio 12.0\Team Tools\Performance Tools - -Start vsperfmon -coverage -output:test.coverage - -REM Now we run all the unit tests to record test coverage -bjam -j8 msvc-12.0 invariant-checks=off asserts=off link=shared boost-link=shared linkflags=/profile deprecated-functions=off - -vsperfcmd -shutdown - From 2921caf95e851a7918026dc159b1717ef5045f30 Mon Sep 17 00:00:00 2001 From: arvidn Date: Sun, 10 Apr 2016 20:46:51 -0400 Subject: [PATCH 8/8] fix msvc test build. make test framework robust to tmpfile() failing. add missing files and tests to makefile --- Jamfile | 2 ++ build_dist.sh | 6 +++--- test/Makefile.am | 32 ++++++++++++++++++++++++++++---- test/main.cpp | 29 ++++++++++++++++++++--------- test/web_seed_suite.cpp | 4 ++-- 5 files changed, 55 insertions(+), 18 deletions(-) diff --git a/Jamfile b/Jamfile index 0adee55bf..ccd636596 100644 --- a/Jamfile +++ b/Jamfile @@ -284,6 +284,8 @@ rule warnings ( properties * ) result += /wd4018 ; # disable warning C4244: 'argument' : conversion from 'int' to 'unsigned short', possible loss of data result += /wd4244 ; +# disable warning C4512: assignment operator could not be generated + result += /wd4512 ; } return $(result) ; diff --git a/build_dist.sh b/build_dist.sh index da9fdd31e..10e2ecaf4 100755 --- a/build_dist.sh +++ b/build_dist.sh @@ -23,8 +23,8 @@ chmod a-x docs/*.rst docs/*.htm* src/*.cpp include/libtorrent/*.hpp ./autotool.sh ./configure --enable-python-binding --enable-examples=yes --enable-encryption --enable-tests=yes --with-boost-system=mt --with-boost-chrono=mt --with-boost-random=mt --with-boost-python=mt -make V=1 -j8 check distcheck - -./configure --enable-python-binding --enable-examples=yes --enable-encryption --with-boost-system=mt --with-boost-chrono=mt --with-boost-random=mt --with-boost-python=mt make V=1 -j8 distcheck +./configure --enable-python-binding --enable-examples=yes --enable-encryption --with-boost-system=mt --with-boost-chrono=mt --with-boost-random=mt --with-boost-python=mt +make V=1 -j8 dist + diff --git a/test/Makefile.am b/test/Makefile.am index 442c44b3e..2ad4f05b1 100644 --- a/test/Makefile.am +++ b/test/Makefile.am @@ -30,12 +30,21 @@ test_programs = \ test_utp \ test_session \ test_web_seed \ + test_web_seed_ban \ + test_web_seed_chunked \ + test_web_seed_http \ + test_web_seed_http_pw \ + test_web_seed_redirect \ + test_web_seed_socks4 \ + test_web_seed_socks5 \ test_web_seed_socks5_no_peers \ + test_web_seed_socks5_pw \ test_url_seed \ test_remap_files \ test_enum_net \ test_file_progress \ - test_linked_list + test_linked_list \ + test_direct_dht if ENABLE_TESTS check_PROGRAMS = $(test_programs) $(benchmark_programs) @@ -101,13 +110,17 @@ EXTRA_DIST = Jamfile \ mutable_test_torrents/test3.torrent \ mutable_test_torrents/test3_pad_files.torrent \ zeroes.gz \ - utf8_test.txt + utf8_test.txt \ + web_server.py \ + socks.py \ + http.py EXTRA_PROGRAMS = $(test_programs) $(benchmark_programs) noinst_HEADERS = test.hpp setup_transfer.hpp dht_server.hpp \ peer_server.hpp udp_tracker.hpp web_seed_suite.hpp swarm_suite.hpp \ - test_utils.hpp settings.hpp make_torrent.hpp + test_utils.hpp settings.hpp make_torrent.hpp bittorrent_peer.hpp \ + print_alerts.hpp libtest_la_SOURCES = main.cpp \ test.cpp \ @@ -115,11 +128,13 @@ libtest_la_SOURCES = main.cpp \ dht_server.cpp \ udp_tracker.cpp \ peer_server.cpp \ + bittorrent_peer.cpp \ make_torrent.cpp \ web_seed_suite.cpp \ swarm_suite.cpp \ test_utils.cpp \ - settings.cpp + settings.cpp \ + print_alerts.cpp test_primitives_SOURCES = \ test_primitives.cpp \ @@ -195,11 +210,20 @@ enum_if_SOURCES = enum_if.cpp test_utp_SOURCES = test_utp.cpp test_session_SOURCES = test_session.cpp test_web_seed_SOURCES = test_web_seed.cpp +test_web_seed_ban_SOURCES = test_web_seed_ban.cpp +test_web_seed_chunked_SOURCES = test_web_seed_chunked.cpp +test_web_seed_http_SOURCES = test_web_seed_http.cpp +test_web_seed_http_pw_SOURCES = test_web_seed_http_pw.cpp +test_web_seed_redirect_SOURCES = test_web_seed_redirect.cpp +test_web_seed_socks4_SOURCES = test_web_seed_socks4.cpp +test_web_seed_socks5_SOURCES = test_web_seed_socks5.cpp test_web_seed_socks5_no_peers_SOURCES = test_web_seed_socks5_no_peers.cpp +test_web_seed_socks5_pw_SOURCES = test_web_seed_socks5_pw.cpp test_url_seed_SOURCES = test_url_seed.cpp test_remap_files_SOURCES = test_remap_files.cpp test_file_progress_SOURCES = test_file_progress.cpp test_linked_list_SOURCES = test_linked_list.cpp +test_direct_dht_SOURCES = test_direct_dht.cpp LDADD = libtest.la $(top_builddir)/src/libtorrent-rasterbar.la diff --git a/test/main.cpp b/test/main.cpp index ffb439ed5..3f210aa53 100644 --- a/test/main.cpp +++ b/test/main.cpp @@ -78,7 +78,7 @@ unit_test_t* current_test = NULL; void output_test_log_to_terminal() { if (current_test == NULL || old_stdout == -1 || old_stderr == -1 - || !redirect_output) + || !redirect_output || current_test->output == NULL) return; fflush(stdout); @@ -299,14 +299,25 @@ EXPORT int main(int argc, char const* argv[]) fflush(stdout); fflush(stderr); - t.output = tmpfile(); - int ret1 = dup2(fileno(t.output), fileno(stdout)); - dup2(fileno(t.output), fileno(stderr)); - if (ret1 < 0 ) + FILE* f = tmpfile(); + if (f != NULL) { - fprintf(stderr, "failed to redirect output: (%d) %s\n" - , errno, strerror(errno)); - continue; + int ret1 = dup2(fileno(f), fileno(stdout)); + dup2(fileno(f), fileno(stderr)); + if (ret1 >= 0) + { + t.output = f; + } + else + { + fprintf(stderr, "failed to redirect output: (%d) %s\n" + , errno, strerror(errno)); + } + } + else + { + fprintf(stderr, "failed to create temporary file for redirecting " + "output: (%d) %s\n", errno, strerror(errno)); } } @@ -350,7 +361,7 @@ EXPORT int main(int argc, char const* argv[]) total_failures += _g_test_failures; ++num_run; - if (redirect_output) + if (redirect_output && t.output) { fclose(t.output); } diff --git a/test/web_seed_suite.cpp b/test/web_seed_suite.cpp index 55d674c8e..b5324db81 100644 --- a/test/web_seed_suite.cpp +++ b/test/web_seed_suite.cpp @@ -232,8 +232,8 @@ void test_transfer(lt::session& ses, boost::shared_ptr torrent_fil , int(cnt["disk.disk_blocks_in_use"])); test_sleep(100); } - TEST_CHECK(std::abs(cnt["disk.disk_blocks_in_use"] - - (torrent_file->total_size() + 0x3fff) / 0x4000) <= 2); + TEST_CHECK(std::abs(int(cnt["disk.disk_blocks_in_use"] + - (torrent_file->total_size() + 0x3fff) / 0x4000)) <= 2); } }