From 430ff6d7b45f4d30d51593a026ca4c7b3db0e9be Mon Sep 17 00:00:00 2001 From: arvidn Date: Sun, 19 Feb 2017 19:34:52 +0200 Subject: [PATCH 1/9] minor fix to num_seeds --- src/torrent.cpp | 2 +- src/torrent_info.cpp | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/torrent.cpp b/src/torrent.cpp index 83f338473..56109e1af 100644 --- a/src/torrent.cpp +++ b/src/torrent.cpp @@ -12224,7 +12224,7 @@ namespace libtorrent st->pieces.resize(num_pieces, false); } st->num_pieces = num_have(); - st->num_seeds = num_seeds(); + st->num_seeds = num_seeds() - int(m_num_connecting_seeds); if ((flags & torrent_handle::query_distributed_copies) && m_picker.get()) { boost::tie(st->distributed_full_copies, st->distributed_fraction) = diff --git a/src/torrent_info.cpp b/src/torrent_info.cpp index 8dc50188b..482bd96b3 100644 --- a/src/torrent_info.cpp +++ b/src/torrent_info.cpp @@ -149,7 +149,7 @@ namespace libtorrent res = ConvertUTF32toUTF8(const_cast(&cp), cp + 1, &start, start + 5, lenientConversion); TORRENT_ASSERT(res == conversionOK); - for (int i = 0; i < start - sequence; ++i) + for (int i = 0; i < std::min(5, int(start - sequence)); ++i) tmp_path += char(sequence[i]); } From 6d40d3a167f0914118a7a36c2aabec94b2345ffc Mon Sep 17 00:00:00 2001 From: arvidn Date: Sun, 19 Feb 2017 12:42:32 -0500 Subject: [PATCH 2/9] bump version number --- CMakeLists.txt | 2 +- ChangeLog | 2 ++ Jamfile | 2 +- bindings/python/setup.py | 2 +- configure.ac | 2 +- docs/building.rst | 2 +- docs/contributing.rst | 2 +- docs/dht_rss.rst | 2 +- docs/dht_sec.rst | 2 +- docs/dht_store.rst | 2 +- docs/examples.rst | 2 +- docs/features.rst | 2 +- docs/gen_reference_doc.py | 2 +- docs/hacking.rst | 2 +- docs/index.rst | 2 +- docs/manual.rst | 2 +- docs/troubleshooting.rst | 2 +- docs/tuning.rst | 2 +- docs/tutorial.rst | 2 +- docs/utp.rst | 2 +- include/libtorrent/version.hpp | 6 +++--- src/settings_pack.cpp | 2 +- 22 files changed, 25 insertions(+), 23 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index e9df1478b..a307d907c 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1,7 +1,7 @@ cmake_minimum_required(VERSION 2.6) project(libtorrent) set (SOVERSION "8") -set (VERSION "1.1.1") +set (VERSION "1.1.2") set(sources web_connection_base diff --git a/ChangeLog b/ChangeLog index 77bb9c186..223d820ef 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,5 @@ +1.1.2 release + * fix invalid access when leaving seed-mode with outstanding hash jobs * fix ABI compatibility issue introduced with preformatted entry type * add web_seed_name_lookup_retry to session_settings diff --git a/Jamfile b/Jamfile index dd4133138..efe2b91cc 100644 --- a/Jamfile +++ b/Jamfile @@ -58,7 +58,7 @@ else : : $(boost-include-path) ; } -VERSION = 1.1.1 ; +VERSION = 1.1.2 ; # rule for linking the correct libraries depending # on features and target-os diff --git a/bindings/python/setup.py b/bindings/python/setup.py index 9492314e5..8f857e2cf 100644 --- a/bindings/python/setup.py +++ b/bindings/python/setup.py @@ -133,7 +133,7 @@ else: libraries = ['torrent-rasterbar'] + flags.libraries)] setup(name = 'python-libtorrent', - version = '1.1.1', + version = '1.1.2', author = 'Arvid Norberg', author_email = 'arvid@libtorrent.org', description = 'Python bindings for libtorrent-rasterbar', diff --git a/configure.ac b/configure.ac index c08e19dfc..df2e859ff 100644 --- a/configure.ac +++ b/configure.ac @@ -5,7 +5,7 @@ AC_PREREQ([2.63]) -AC_INIT([libtorrent-rasterbar],[1.1.1],[arvid@libtorrent.org], +AC_INIT([libtorrent-rasterbar],[1.1.2],[arvid@libtorrent.org], [libtorrent-rasterbar],[http://www.libtorrent.org]) AC_CONFIG_SRCDIR([src/torrent.cpp]) AC_CONFIG_AUX_DIR([build-aux]) diff --git a/docs/building.rst b/docs/building.rst index 9476448d6..14731cec2 100644 --- a/docs/building.rst +++ b/docs/building.rst @@ -3,7 +3,7 @@ libtorrent manual ================= :Author: Arvid Norberg, arvid@libtorrent.org -:Version: 1.1.1 +:Version: 1.1.2 .. contents:: Table of contents :depth: 2 diff --git a/docs/contributing.rst b/docs/contributing.rst index 00a7a988b..d47f77dc5 100644 --- a/docs/contributing.rst +++ b/docs/contributing.rst @@ -3,7 +3,7 @@ libtorrent manual ================= :Author: Arvid Norberg, arvid@libtorrent.org -:Version: 1.1.1 +:Version: 1.1.2 .. contents:: Table of contents :depth: 2 diff --git a/docs/dht_rss.rst b/docs/dht_rss.rst index c3dcc32e1..37debbf14 100644 --- a/docs/dht_rss.rst +++ b/docs/dht_rss.rst @@ -3,7 +3,7 @@ BitTorrent extension for DHT RSS feeds ====================================== :Author: Arvid Norberg, arvid@libtorrent.org -:Version: 1.1.1 +:Version: 1.1.2 .. contents:: Table of contents :depth: 2 diff --git a/docs/dht_sec.rst b/docs/dht_sec.rst index 67fea182f..e29fb1f90 100644 --- a/docs/dht_sec.rst +++ b/docs/dht_sec.rst @@ -3,7 +3,7 @@ BitTorrent DHT security extension ================================= :Author: Arvid Norberg, arvid@libtorrent.org -:Version: 1.1.1 +:Version: 1.1.2 .. contents:: Table of contents :depth: 2 diff --git a/docs/dht_store.rst b/docs/dht_store.rst index 86a5c90a5..a27cbc3c9 100644 --- a/docs/dht_store.rst +++ b/docs/dht_store.rst @@ -3,7 +3,7 @@ BitTorrent extension for arbitrary DHT store ============================================ :Author: Arvid Norberg, arvid@libtorrent.org -:Version: 1.1.1 +:Version: 1.1.2 .. contents:: Table of contents :depth: 2 diff --git a/docs/examples.rst b/docs/examples.rst index 21a171495..00a644de5 100644 --- a/docs/examples.rst +++ b/docs/examples.rst @@ -3,7 +3,7 @@ libtorrent Examples =================== :Author: Arvid Norberg, arvid@libtorrent.org -:Version: 1.1.1 +:Version: 1.1.2 .. contents:: Table of contents :depth: 2 diff --git a/docs/features.rst b/docs/features.rst index 7f2cc4f06..03bb4ddc8 100644 --- a/docs/features.rst +++ b/docs/features.rst @@ -3,7 +3,7 @@ libtorrent manual ================= :Author: Arvid Norberg, arvid@libtorrent.org -:Version: 1.1.1 +:Version: 1.1.2 .. contents:: Table of contents :depth: 2 diff --git a/docs/gen_reference_doc.py b/docs/gen_reference_doc.py index 933e8bddf..6b261fe4a 100644 --- a/docs/gen_reference_doc.py +++ b/docs/gen_reference_doc.py @@ -1005,7 +1005,7 @@ for cat in categories: out.write(''' :Author: Arvid Norberg, arvid@libtorrent.org -:Version: 1.1.1 +:Version: 1.1.2 `home`__ diff --git a/docs/hacking.rst b/docs/hacking.rst index d4a5b4078..66c9c6fe1 100644 --- a/docs/hacking.rst +++ b/docs/hacking.rst @@ -3,7 +3,7 @@ libtorrent hacking ================== :Author: Arvid Norberg, arvid@libtorrent.org -:Version: 1.1.1 +:Version: 1.1.2 .. contents:: Table of contents :depth: 2 diff --git a/docs/index.rst b/docs/index.rst index cb033c694..008a0a553 100644 --- a/docs/index.rst +++ b/docs/index.rst @@ -1,5 +1,5 @@ :Author: Arvid Norberg, arvid@libtorrent.org -:Version: 1.1.1 +:Version: 1.1.2 .. raw:: html diff --git a/docs/manual.rst b/docs/manual.rst index 43000d7e4..46921d645 100644 --- a/docs/manual.rst +++ b/docs/manual.rst @@ -3,7 +3,7 @@ libtorrent API Documentation ============================ :Author: Arvid Norberg, arvid@libtorrent.org -:Version: 1.1.1 +:Version: 1.1.2 .. contents:: Table of contents :depth: 1 diff --git a/docs/troubleshooting.rst b/docs/troubleshooting.rst index b058e8015..4dd599d91 100644 --- a/docs/troubleshooting.rst +++ b/docs/troubleshooting.rst @@ -3,7 +3,7 @@ libtorrent manual ================= :Author: Arvid Norberg, arvid@libtorrent.org -:Version: 1.1.1 +:Version: 1.1.2 .. contents:: Table of contents :depth: 2 diff --git a/docs/tuning.rst b/docs/tuning.rst index 53bd3b5b4..53b1652ac 100644 --- a/docs/tuning.rst +++ b/docs/tuning.rst @@ -3,7 +3,7 @@ libtorrent manual ================= :Author: Arvid Norberg, arvid@libtorrent.org -:Version: 1.1.1 +:Version: 1.1.2 .. contents:: Table of contents :depth: 2 diff --git a/docs/tutorial.rst b/docs/tutorial.rst index 47cd26783..a7433ee5b 100644 --- a/docs/tutorial.rst +++ b/docs/tutorial.rst @@ -3,7 +3,7 @@ libtorrent manual ================= :Author: Arvid Norberg, arvid@libtorrent.org -:Version: 1.1.1 +:Version: 1.1.2 .. contents:: Table of contents :depth: 2 diff --git a/docs/utp.rst b/docs/utp.rst index f92dd2e4e..4233a4369 100644 --- a/docs/utp.rst +++ b/docs/utp.rst @@ -3,7 +3,7 @@ libtorrent manual ================= :Author: Arvid Norberg, arvid@libtorrent.org -:Version: 1.1.1 +:Version: 1.1.2 .. contents:: Table of contents :depth: 2 diff --git a/include/libtorrent/version.hpp b/include/libtorrent/version.hpp index 75f8d5300..6e01fbeec 100644 --- a/include/libtorrent/version.hpp +++ b/include/libtorrent/version.hpp @@ -37,14 +37,14 @@ POSSIBILITY OF SUCH DAMAGE. #define LIBTORRENT_VERSION_MAJOR 1 #define LIBTORRENT_VERSION_MINOR 1 -#define LIBTORRENT_VERSION_TINY 1 +#define LIBTORRENT_VERSION_TINY 2 // the format of this version is: MMmmtt // M = Major version, m = minor version, t = tiny version #define LIBTORRENT_VERSION_NUM ((LIBTORRENT_VERSION_MAJOR * 10000) + (LIBTORRENT_VERSION_MINOR * 100) + LIBTORRENT_VERSION_TINY) -#define LIBTORRENT_VERSION "1.1.1.0" -#define LIBTORRENT_REVISION "1229491" +#define LIBTORRENT_VERSION "1.1.2.0" +#define LIBTORRENT_REVISION "6e65851" namespace libtorrent { diff --git a/src/settings_pack.cpp b/src/settings_pack.cpp index b498aae5f..ceec06f9a 100644 --- a/src/settings_pack.cpp +++ b/src/settings_pack.cpp @@ -142,7 +142,7 @@ namespace libtorrent SET_NOPREV(proxy_username, "", &session_impl::update_proxy), SET_NOPREV(proxy_password, "", &session_impl::update_proxy), SET_NOPREV(i2p_hostname, "", &session_impl::update_i2p_bridge), - SET_NOPREV(peer_fingerprint, "-LT1110-", &session_impl::update_peer_fingerprint), + SET_NOPREV(peer_fingerprint, "-LT1120-", &session_impl::update_peer_fingerprint), SET_NOPREV(dht_bootstrap_nodes, "dht.libtorrent.org:25401", &session_impl::update_dht_bootstrap_nodes) }; From 9bb420b074dd9504ae696d046a81520c5945f88b Mon Sep 17 00:00:00 2001 From: sledgehammer_999 Date: Mon, 20 Feb 2017 01:30:40 +0200 Subject: [PATCH 3/9] Move include into implementation instead(from #1703). --- bindings/python/src/create_torrent.cpp | 1 + include/libtorrent/create_torrent.hpp | 1 - 2 files changed, 1 insertion(+), 1 deletion(-) diff --git a/bindings/python/src/create_torrent.cpp b/bindings/python/src/create_torrent.cpp index 13cb61f9e..5f6cafcd0 100644 --- a/bindings/python/src/create_torrent.cpp +++ b/bindings/python/src/create_torrent.cpp @@ -6,6 +6,7 @@ #include #include #include "libtorrent/torrent_info.hpp" +#include #include "bytes.hpp" using namespace boost::python; diff --git a/include/libtorrent/create_torrent.hpp b/include/libtorrent/create_torrent.hpp index 37cea88d7..9d05a11ba 100644 --- a/include/libtorrent/create_torrent.hpp +++ b/include/libtorrent/create_torrent.hpp @@ -39,7 +39,6 @@ POSSIBILITY OF SUCH DAMAGE. #include "libtorrent/storage.hpp" #include "libtorrent/hasher.hpp" #include "libtorrent/file.hpp" // for combine_path etc. -#include "libtorrent/version.hpp" #include "libtorrent/aux_/disable_warnings_push.hpp" From 0e500978cde379789e5edc8e172e3463d2ce7995 Mon Sep 17 00:00:00 2001 From: Calum Lind Date: Tue, 21 Feb 2017 18:46:30 +0000 Subject: [PATCH 4/9] Add a python bindings test for pickling trackers * If ae.last_error (lt.error_code) is not converted in bindings to a dict then pickling the trackers with fail. --- bindings/python/test.py | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/bindings/python/test.py b/bindings/python/test.py index 9217f70ec..41da3d7e2 100644 --- a/bindings/python/test.py +++ b/bindings/python/test.py @@ -8,6 +8,7 @@ import os import shutil import binascii import inspect +import pickle class test_create_torrent(unittest.TestCase): @@ -72,6 +73,20 @@ class test_torrent_handle(unittest.TestCase): self.assertEqual(new_trackers[1]['tier'], 1) self.assertEqual(new_trackers[1]['fail_limit'], 2) + def test_pickle_trackers(self): + """Test lt objects convertors are working and trackers can be pickled""" + self.setup() + tracker = lt.announce_entry('udp://tracker1.com') + tracker.tier = 0 + tracker.fail_limit = 1 + trackers = [tracker] + self.h.replace_trackers(trackers) + tracker_list = [tracker for tracker in self.h.trackers()] + pickled_trackers = pickle.dumps(tracker_list) + unpickled_trackers = pickle.loads(pickled_trackers) + self.assertEqual(unpickled_trackers[0]['url'], 'udp://tracker1.com') + self.assertEqual(unpickled_trackers[0]['last_error']['value'], 0) + def test_file_status(self): self.setup() l = self.h.file_status() @@ -158,6 +173,7 @@ class test_torrent_info(unittest.TestCase): self.assertEquals(ae.can_announce(False), True) self.assertEquals(ae.scrape_incomplete, -1) self.assertEquals(ae.next_announce, None) + self.assertEquals(ae.last_error['value'], 0) class test_alerts(unittest.TestCase): From 3b359abc14837f715ae9d06361d5a991ed68d953 Mon Sep 17 00:00:00 2001 From: arvidn Date: Tue, 21 Feb 2017 19:04:36 -0500 Subject: [PATCH 5/9] add pickle support to error_code python binding --- bindings/python/src/error_code.cpp | 70 ++++++++++++++++++++++++++++++ bindings/python/test.py | 4 +- 2 files changed, 72 insertions(+), 2 deletions(-) diff --git a/bindings/python/src/error_code.cpp b/bindings/python/src/error_code.cpp index c01022b97..0f772efa3 100644 --- a/bindings/python/src/error_code.cpp +++ b/bindings/python/src/error_code.cpp @@ -34,12 +34,81 @@ POSSIBILITY OF SUCH DAMAGE. #include #include #include +#include +#if defined TORRENT_USE_OPENSSL +#include +#endif #include "boost_python.hpp" using namespace boost::python; using namespace libtorrent; using boost::system::error_category; +namespace { + + struct ec_pickle_suite : boost::python::pickle_suite + { + static boost::python::tuple + getinitargs(error_code const& ec) + { + return boost::python::tuple(); + } + + static boost::python::tuple + getstate(error_code const& ec) + { + return boost::python::make_tuple(ec.value(), ec.category().name()); + } + + static void + setstate(error_code& ec, boost::python::tuple state) + { + using namespace boost::python; + if (len(state) != 2) + { + PyErr_SetObject(PyExc_ValueError, + ("expected 2-item tuple in call to __setstate__; got %s" + % state).ptr()); + throw_error_already_set(); + } + + int const value = extract(state[0]); + std::string const category = extract(state[1]); + if (category == "system") + ec.assign(value, libtorrent::system_category()); + else if (category == "generic") + ec.assign(value, libtorrent::generic_category()); + else if (category == "libtorrent") + ec.assign(value, libtorrent::libtorrent_category()); + else if (category == "http error") + ec.assign(value, libtorrent::http_category()); + else if (category == "UPnP error") + ec.assign(value, libtorrent::upnp_category()); + else if (category == "bdecode error") + ec.assign(value, libtorrent::bdecode_category()); + else if (category == "asio.netdb") + ec.assign(value, boost::asio::error::get_netdb_category()); + else if (category == "asio.addinfo") + ec.assign(value, boost::asio::error::get_addrinfo_category()); + else if (category == "asio.misc") + ec.assign(value, boost::asio::error::get_misc_category()); + else if (category == "asio.misc") + ec.assign(value, boost::asio::error::get_misc_category()); +#if defined TORRENT_USE_OPENSSL + else if (category == "asio.ssl") + ec.assign(value, boost::asio::error::get_ssl_category()); +#endif + else + { + PyErr_SetObject(PyExc_ValueError, + ("unexpected error_category passed to __setstate__; got '%s'" + % object(category)).ptr()); + throw_error_already_set(); + } + } + }; +} + void bind_error_code() { class_("error_category", no_init) @@ -58,6 +127,7 @@ void bind_error_code() .def("category", &error_code::category , return_internal_reference<>()) .def("assign", &error_code::assign) + .def_pickle(ec_pickle_suite()) ; typedef return_value_policy return_existing; diff --git a/bindings/python/test.py b/bindings/python/test.py index 41da3d7e2..bf6d9e674 100644 --- a/bindings/python/test.py +++ b/bindings/python/test.py @@ -85,7 +85,7 @@ class test_torrent_handle(unittest.TestCase): pickled_trackers = pickle.dumps(tracker_list) unpickled_trackers = pickle.loads(pickled_trackers) self.assertEqual(unpickled_trackers[0]['url'], 'udp://tracker1.com') - self.assertEqual(unpickled_trackers[0]['last_error']['value'], 0) + self.assertEqual(unpickled_trackers[0]['last_error'].value(), 0) def test_file_status(self): self.setup() @@ -173,7 +173,7 @@ class test_torrent_info(unittest.TestCase): self.assertEquals(ae.can_announce(False), True) self.assertEquals(ae.scrape_incomplete, -1) self.assertEquals(ae.next_announce, None) - self.assertEquals(ae.last_error['value'], 0) + self.assertEquals(ae.last_error.value(), 0) class test_alerts(unittest.TestCase): From 3e83c4119f73e245aa5a487f798a7eec797e9de9 Mon Sep 17 00:00:00 2001 From: Arvid Norberg Date: Fri, 24 Feb 2017 08:06:59 -0500 Subject: [PATCH 6/9] fix recent settings_pack ABI regression (#1752) fix recent settings_pack ABI regression --- include/libtorrent/settings_pack.hpp | 38 ++++++++++++++-------------- src/settings_pack.cpp | 6 ++--- test/test.cpp | 3 ++- test/test_settings_pack.cpp | 28 ++++++++++++++++++++ 4 files changed, 52 insertions(+), 23 deletions(-) diff --git a/include/libtorrent/settings_pack.hpp b/include/libtorrent/settings_pack.hpp index 70814b445..0dc760402 100644 --- a/include/libtorrent/settings_pack.hpp +++ b/include/libtorrent/settings_pack.hpp @@ -777,27 +777,9 @@ namespace libtorrent // low number, like 5 urlseed_pipeline_size, - // The maximum request range of an url seed in bytes. This value - // defines the largest possible sequential web seed request. Default - // is 16 * 1024 * 1024. Lower values are possible but will be ignored - // if they are lower then piece size. - // This value should be related to your download speed to prevent - // libtorrent from creating too many expensive http requests per - // second. You can select a value as high as you want but keep in mind - // that libtorrent can't create parallel requests if the first request - // did already select the whole file. - // If you combine bittorrent seeds with web seeds and pick strategies - // like rarest first you may find your web seed requests split into - // smaller parts because we don't download already picked pieces - // twice. - urlseed_max_request_bytes, - // time to wait until a new retry of a web seed takes place urlseed_wait_retry, - - // time to wait until a new retry of a web seed name lookup - web_seed_name_lookup_retry, - + // sets the upper limit on the total number of files this session will // keep open. The reason why files are left open at all is that some // anti virus software hooks on every file close, and scans the file @@ -1594,6 +1576,24 @@ namespace libtorrent // them in the cache is limited. cache_size_volatile, + // The maximum request range of an url seed in bytes. This value + // defines the largest possible sequential web seed request. Default + // is 16 * 1024 * 1024. Lower values are possible but will be ignored + // if they are lower then piece size. + // This value should be related to your download speed to prevent + // libtorrent from creating too many expensive http requests per + // second. You can select a value as high as you want but keep in mind + // that libtorrent can't create parallel requests if the first request + // did already select the whole file. + // If you combine bittorrent seeds with web seeds and pick strategies + // like rarest first you may find your web seed requests split into + // smaller parts because we don't download already picked pieces + // twice. + urlseed_max_request_bytes, + + // time to wait until a new retry of a web seed name lookup + web_seed_name_lookup_retry, + max_int_setting_internal }; diff --git a/src/settings_pack.cpp b/src/settings_pack.cpp index ceec06f9a..c7be06e92 100644 --- a/src/settings_pack.cpp +++ b/src/settings_pack.cpp @@ -234,9 +234,7 @@ namespace libtorrent SET(peer_timeout, 120, 0), SET(urlseed_timeout, 20, 0), SET(urlseed_pipeline_size, 5, 0), - SET_NOPREV(urlseed_max_request_bytes, 16 * 1024 * 1024, 0), SET(urlseed_wait_retry, 30, 0), - SET_NOPREV(web_seed_name_lookup_retry, 1800, 0), SET(file_pool_size, 40, 0), SET(max_failcount, 3, &session_impl::update_max_failcount), SET(min_reconnect_time, 60, 0), @@ -349,7 +347,9 @@ namespace libtorrent SET_NOPREV(proxy_type, settings_pack::none, &session_impl::update_proxy), SET_NOPREV(proxy_port, 0, &session_impl::update_proxy), SET_NOPREV(i2p_port, 0, &session_impl::update_i2p_bridge), - SET_NOPREV(cache_size_volatile, 256, 0) + SET_NOPREV(cache_size_volatile, 256, 0), + SET_NOPREV(urlseed_max_request_bytes, 16 * 1024 * 1024, 0), + SET_NOPREV(web_seed_name_lookup_retry, 1800, 0), }; #undef SET diff --git a/test/test.cpp b/test/test.cpp index 770db6ce9..f2a47e01b 100644 --- a/test/test.cpp +++ b/test/test.cpp @@ -89,7 +89,8 @@ int print_failures() fprintf(stderr, "\x1b[0m"); if (total_num_failures > 0) - fprintf(stderr, "\n\n\x1b[41m == %d TEST(S) FAILED ==\x1b[0m\n\n\n", _g_test_failures); + fprintf(stderr, "\n\n\x1b[41m == %d TEST(S) FAILED ==\x1b[0m\n\n\n" + , total_num_failures); return total_num_failures; } diff --git a/test/test_settings_pack.cpp b/test/test_settings_pack.cpp index 79faf9c49..45728e301 100644 --- a/test/test_settings_pack.cpp +++ b/test/test_settings_pack.cpp @@ -196,5 +196,33 @@ TORRENT_TEST(duplicates) TEST_EQUAL(p.get_str(settings_pack::peer_fingerprint), "hij"); } +TORRENT_TEST(settings_pack_abi) +{ + // make sure enum values are preserved across libtorrent versions + // for ABI compatibility + // These values are only allowed to change across major versions + + TEST_EQUAL(settings_pack::string_type_base, 0x0000); + TEST_EQUAL(settings_pack::int_type_base, 0x4000); + TEST_EQUAL(settings_pack::bool_type_base, 0x8000); + TEST_EQUAL(settings_pack::type_mask, 0xc000); + + // strings + TEST_EQUAL(settings_pack::outgoing_interfaces, settings_pack::string_type_base + 4); + TEST_EQUAL(settings_pack::dht_bootstrap_nodes, settings_pack::string_type_base + 11); + + // bool + TEST_EQUAL(settings_pack::lazy_bitfields, settings_pack::bool_type_base + 3); + TEST_EQUAL(settings_pack::use_read_cache, settings_pack::bool_type_base + 7); + TEST_EQUAL(settings_pack::proxy_tracker_connections, settings_pack::bool_type_base + 68); + + // ints + TEST_EQUAL(settings_pack::max_suggest_pieces, settings_pack::int_type_base + 66); + TEST_EQUAL(settings_pack::connections_slack, settings_pack::int_type_base + 86); + TEST_EQUAL(settings_pack::aio_threads, settings_pack::int_type_base + 104); + TEST_EQUAL(settings_pack::max_http_recv_buffer_size, settings_pack::int_type_base + 115); + TEST_EQUAL(settings_pack::web_seed_name_lookup_retry, settings_pack::int_type_base + 128); +} + // TODO: load_pack_from_dict From 2258b53d87192a0358a7e82edecd33e037ba7769 Mon Sep 17 00:00:00 2001 From: arvidn Date: Fri, 24 Feb 2017 16:13:49 -0500 Subject: [PATCH 7/9] in python binding, make announce_entry::last_error a dict instead of error_code --- bindings/python/src/torrent_handle.cpp | 5 ++++- bindings/python/test.py | 9 ++++++++- 2 files changed, 12 insertions(+), 2 deletions(-) diff --git a/bindings/python/src/torrent_handle.cpp b/bindings/python/src/torrent_handle.cpp index 66b6bd3ae..ea16d66b8 100644 --- a/bindings/python/src/torrent_handle.cpp +++ b/bindings/python/src/torrent_handle.cpp @@ -241,7 +241,10 @@ list trackers(torrent_handle& h) d["url"] = i->url; d["trackerid"] = i->trackerid; d["message"] = i->message; - d["last_error"] = i->last_error; + dict last_error; + last_error["value"] = i->last_error.value(); + last_error["category"] = i->last_error.category().name(); + d["last_error"] = last_error; d["next_announce"] = i->next_announce; d["min_announce"] = i->min_announce; d["scrape_incomplete"] = i->scrape_incomplete; diff --git a/bindings/python/test.py b/bindings/python/test.py index bf6d9e674..da4f8932c 100644 --- a/bindings/python/test.py +++ b/bindings/python/test.py @@ -85,7 +85,7 @@ class test_torrent_handle(unittest.TestCase): pickled_trackers = pickle.dumps(tracker_list) unpickled_trackers = pickle.loads(pickled_trackers) self.assertEqual(unpickled_trackers[0]['url'], 'udp://tracker1.com') - self.assertEqual(unpickled_trackers[0]['last_error'].value(), 0) + self.assertEqual(unpickled_trackers[0]['last_error']['value'], 0) def test_file_status(self): self.setup() @@ -105,6 +105,13 @@ class test_torrent_handle(unittest.TestCase): st2 = self.h.status() self.assertEqual(st2, st) + def test_serialize_trackers(self): + """Test to ensure the dict contains only python built-in types""" + self.setup() + self.h.add_tracker({'url':'udp://tracker1.com'}) + import json + print(json.dumps(self.h.trackers()[0])) + def test_scrape(self): self.setup() # this is just to make sure this function can be called like this From ff106f8c9e1ee4c63b16345ffa0bab6ba2a25a3d Mon Sep 17 00:00:00 2001 From: arvidn Date: Sat, 25 Feb 2017 12:16:44 -0500 Subject: [PATCH 8/9] default TOS marking to 0x20 --- ChangeLog | 1 + src/settings_pack.cpp | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/ChangeLog b/ChangeLog index 223d820ef..a17b19d93 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,6 @@ 1.1.2 release + * default TOS marking to 0x20 * fix invalid access when leaving seed-mode with outstanding hash jobs * fix ABI compatibility issue introduced with preformatted entry type * add web_seed_name_lookup_retry to session_settings diff --git a/src/settings_pack.cpp b/src/settings_pack.cpp index c7be06e92..a51419dfb 100644 --- a/src/settings_pack.cpp +++ b/src/settings_pack.cpp @@ -262,7 +262,7 @@ namespace libtorrent SET(disk_io_read_mode, settings_pack::enable_os_cache, 0), SET(outgoing_port, 0, 0), SET(num_outgoing_ports, 0, 0), - SET(peer_tos, 0, &session_impl::update_peer_tos), + SET(peer_tos, 0x20, &session_impl::update_peer_tos), SET(active_downloads, 3, &session_impl::trigger_auto_manage), SET(active_seeds, 5, &session_impl::trigger_auto_manage), SET_NOPREV(active_checking, 1, &session_impl::trigger_auto_manage), From 5a19c9a5a180ed115e82f68fd46a5385fc660b04 Mon Sep 17 00:00:00 2001 From: arvidn Date: Sat, 25 Feb 2017 14:09:11 -0500 Subject: [PATCH 9/9] fix makefile --- .travis.yml | 12 +++++++++++- examples/Makefile.am | 2 ++ include/libtorrent/alert_types.hpp | 4 ++-- include/libtorrent/aux_/file_progress.hpp | 2 +- test/Makefile.am | 3 ++- test/test_ed25519.cpp | 2 +- 6 files changed, 19 insertions(+), 6 deletions(-) diff --git a/.travis.yml b/.travis.yml index 2d6cdff96..bd313435e 100644 --- a/.travis.yml +++ b/.travis.yml @@ -5,7 +5,7 @@ matrix: - env: variant=test_release lang=cpp11 sim=0 coverage=1 docs=1 - env: variant=test_debug lang=sanitizer sim=1 coverage=0 - env: variant=test_debug lang=cpp98 sim=0 coverage=0 - - env: variant=test_barebones lang=cpp11 sim=0 coverage=0 + - env: variant=test_barebones lang=cpp11 sim=0 coverage=0 autotools=1 - env: variant=test_debug lang=cpp11 sim=0 coverage=0 target=osx-tests os: osx @@ -113,6 +113,16 @@ script: fi - cd .. +# run through autotools and ./configure to make sure it works + - 'if [[ "$autotools" == "1" ]]; then + ./autotool.sh && + export CXX=g++-5 && + export CC=gcc-5 && + export CXXFLAGS="-Werror -Wno-deprecated-declarations" && + ./configure --enable-debug --enable-encryption --enable-examples --enable-tests --enable-python-binding && + make -j2; + fi' + # build libtorrent separately and install it in a temporary (well known) dir # we have to do this because on linux the name of the python module is the same # as the main library, so we can't stage them to the same directory diff --git a/examples/Makefile.am b/examples/Makefile.am index f786fc8e6..5b65febbf 100644 --- a/examples/Makefile.am +++ b/examples/Makefile.am @@ -20,6 +20,8 @@ client_test_SOURCES = client_test.cpp print.cpp session_view.cpp torrent_view.cp stats_counters_SOURCES = stats_counters.cpp bt_get_SOURCES = bt-get.cpp bt_get2_SOURCES = bt-get2.cpp +bt_get_CXXFLAGS = -std=c++11 +bt_get2_CXXFLAGS = -std=c++11 dump_torrent_SOURCES = dump_torrent.cpp make_torrent_SOURCES = make_torrent.cpp simple_client_SOURCES = simple_client.cpp diff --git a/include/libtorrent/alert_types.hpp b/include/libtorrent/alert_types.hpp index 0bddfa547..ab482b443 100644 --- a/include/libtorrent/alert_types.hpp +++ b/include/libtorrent/alert_types.hpp @@ -2452,6 +2452,8 @@ namespace libtorrent // picker_log_notification). struct TORRENT_EXPORT picker_log_alert TORRENT_FINAL : peer_alert { + TORRENT_DEFINE_ALERT(picker_log_alert, 89) + #ifndef TORRENT_DISABLE_LOGGING // internal @@ -2459,8 +2461,6 @@ namespace libtorrent , tcp::endpoint const& ep, peer_id const& peer_id, boost::uint32_t flags , piece_block const* blocks, int num_blocks); - TORRENT_DEFINE_ALERT(picker_log_alert, 89) - static const int static_category = alert::picker_log_notification; virtual std::string message() const TORRENT_OVERRIDE; diff --git a/include/libtorrent/aux_/file_progress.hpp b/include/libtorrent/aux_/file_progress.hpp index c56e0fd11..f8926b457 100644 --- a/include/libtorrent/aux_/file_progress.hpp +++ b/include/libtorrent/aux_/file_progress.hpp @@ -84,7 +84,7 @@ namespace aux // to make sure we never say we've downloaded more bytes of a file than // its file size - std::vector m_file_sizes; + std::vector m_file_sizes; #endif }; diff --git a/test/Makefile.am b/test/Makefile.am index 69950084f..b7b6cc0f1 100644 --- a/test/Makefile.am +++ b/test/Makefile.am @@ -47,7 +47,7 @@ test_programs = \ test_file_progress \ test_linked_list \ test_direct_dht \ - test_ed25519.cpp + test_ed25519 if ENABLE_TESTS check_PROGRAMS = $(test_programs) $(benchmark_programs) @@ -234,6 +234,7 @@ 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 +test_ed25519_SOURCES = test_ed25519.cpp LDADD = libtest.la $(top_builddir)/src/libtorrent-rasterbar.la diff --git a/test/test_ed25519.cpp b/test/test_ed25519.cpp index 5bebe69d4..d3ade1771 100644 --- a/test/test_ed25519.cpp +++ b/test/test_ed25519.cpp @@ -36,7 +36,7 @@ POSSIBILITY OF SUCH DAMAGE. #include -#include +#include "libtorrent/ed25519.hpp" #include "libtorrent/hex.hpp" using namespace libtorrent;