From 907dc9ddddef11c19a4039fa4489167314514ee6 Mon Sep 17 00:00:00 2001 From: Arvid Norberg Date: Wed, 22 Oct 2014 07:05:10 +0000 Subject: [PATCH] merged changes from RC_1_0 --- CMakeLists.txt | 2 +- ChangeLog | 2 ++ bindings/python/setup.py | 2 +- docs/examples.html | 2 +- docs/examples.rst | 2 +- docs/gen_reference_doc.py | 2 +- docs/index.html | 2 +- docs/index.rst | 2 +- docs/troubleshooting.rst | 2 +- include/libtorrent/session.hpp | 2 +- include/libtorrent/torrent_info.hpp | 43 +++++++++++++---------- set_version.py | 2 +- test/test_checking.cpp | 54 +++++++++++++++++++++++++---- test/test_web_seed_redirect.cpp | 5 --- 14 files changed, 85 insertions(+), 39 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index f3bc3865b..dc69a1e26 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") +set (VERSION "1.1.0") set(sources web_connection_base diff --git a/ChangeLog b/ChangeLog index 54690fc3d..e6f9f1031 100644 --- a/ChangeLog +++ b/ChangeLog @@ -32,6 +32,8 @@ * almost completely changed the storage interface (for custom storage) * added support for hashing pieces in multiple threads +1.0.3 release + * fix protocol race-condition in super seeding mode * support read-only DHT nodes * remove unused partial hash DHT lookups diff --git a/bindings/python/setup.py b/bindings/python/setup.py index 81840f59b..8050de0bb 100644 --- a/bindings/python/setup.py +++ b/bindings/python/setup.py @@ -104,7 +104,7 @@ else: libraries = ['torrent-rasterbar'] + parse_cmd(extra_cmd, '-l'))] setup(name = 'python-libtorrent', - version = '1.0.1', + version = '1.1.0', author = 'Arvid Norberg', author_email = 'arvid@libtorrent.org', description = 'Python bindings for libtorrent-rasterbar', diff --git a/docs/examples.html b/docs/examples.html index 0319fa9e6..baa2a700a 100644 --- a/docs/examples.html +++ b/docs/examples.html @@ -41,7 +41,7 @@ Author: Arvid Norberg, arvid@libtorrent.org Version: -1.0.2 +1.0.3
diff --git a/docs/examples.rst b/docs/examples.rst index 7725187e5..9e153611a 100644 --- a/docs/examples.rst +++ b/docs/examples.rst @@ -3,7 +3,7 @@ libtorrent Examples =================== :Author: Arvid Norberg, arvid@libtorrent.org -:Version: 1.0.2 +:Version: 1.1.0 .. contents:: Table of contents :depth: 2 diff --git a/docs/gen_reference_doc.py b/docs/gen_reference_doc.py index dc83c4ad4..fb267250e 100644 --- a/docs/gen_reference_doc.py +++ b/docs/gen_reference_doc.py @@ -924,7 +924,7 @@ for cat in categories: out.write(''' :Author: Arvid Norberg, arvid@libtorrent.org -:Version: 1.0.0 +:Version: 1.1.0 .. contents:: Table of contents :depth: 1 diff --git a/docs/index.html b/docs/index.html index 59577c302..7ce43bdb1 100644 --- a/docs/index.html +++ b/docs/index.html @@ -41,7 +41,7 @@ Author: Arvid Norberg, arvid@libtorrent.org Version: -1.0.2 +1.0.3
    diff --git a/docs/index.rst b/docs/index.rst index 42b6bedc6..e312b78c4 100644 --- a/docs/index.rst +++ b/docs/index.rst @@ -1,5 +1,5 @@ :Author: Arvid Norberg, arvid@libtorrent.org -:Version: 1.0.2 +:Version: 1.1.0 .. raw:: html diff --git a/docs/troubleshooting.rst b/docs/troubleshooting.rst index 7d11ceb41..3166e5994 100644 --- a/docs/troubleshooting.rst +++ b/docs/troubleshooting.rst @@ -3,7 +3,7 @@ libtorrent manual ================= :Author: Arvid Norberg, arvid@libtorrent.org -:Version: 1.0.0 +:Version: 1.1.0 .. contents:: Table of contents :depth: 2 diff --git a/include/libtorrent/session.hpp b/include/libtorrent/session.hpp index acd02e863..85abc634f 100644 --- a/include/libtorrent/session.hpp +++ b/include/libtorrent/session.hpp @@ -598,7 +598,7 @@ namespace libtorrent // structure. sha1_hash dht_put_item(entry data); - // store an immutable item. The ``key`` is the public key the blob is + // store a mutable item. The ``key`` is the public key the blob is // to be stored under. The optional ``salt`` argument is a string that // is to be mixed in with the key when determining where in the DHT // the value is to be stored. The callback function is called from within diff --git a/include/libtorrent/torrent_info.hpp b/include/libtorrent/torrent_info.hpp index e498fb307..eccacc65a 100644 --- a/include/libtorrent/torrent_info.hpp +++ b/include/libtorrent/torrent_info.hpp @@ -309,28 +309,35 @@ namespace libtorrent { public: - // The constructor that takes an info-hash will initialize the info-hash to the given value, - // but leave all other fields empty. This is used internally when downloading torrents without - // the metadata. The metadata will be created by libtorrent as soon as it has been downloaded - // from the swarm. + // The constructor that takes an info-hash will initialize the info-hash + // to the given value, but leave all other fields empty. This is used + // internally when downloading torrents without the metadata. The + // metadata will be created by libtorrent as soon as it has been + // downloaded from the swarm. // - // The constructor that takes a lazy_entry will create a torrent_info object from the - // information found in the given torrent_file. The lazy_entry represents a tree node in - // an bencoded file. To load an ordinary .torrent file - // into a lazy_entry, use lazy_bdecode(). + // The constructor that takes a lazy_entry will create a torrent_info + // object from the information found in the given torrent_file. The + // lazy_entry represents a tree node in an bencoded file. To load an + // ordinary .torrent file into a lazy_entry, use lazy_bdecode(). // - // The version that takes a buffer pointer and a size will decode it as a .torrent file and - // initialize the torrent_info object for you. + // The version that takes a buffer pointer and a size will decode it as a + // .torrent file and initialize the torrent_info object for you. // - // The version that takes a filename will simply load the torrent file and decode it inside - // the constructor, for convenience. This might not be the most suitable for applications that - // want to be able to report detailed errors on what might go wrong. + // The version that takes a filename will simply load the torrent file + // and decode it inside the constructor, for convenience. This might not + // be the most suitable for applications that want to be able to report + // detailed errors on what might go wrong. + // + // There is an upper limit on the size of the torrent file that will be + // loaded by the overload taking a filename. If it's important that even + // very large torrent files are loaded, use one of the other overloads. // - // The overloads that takes an ``error_code const&`` never throws if an error occur, they - // will simply set the error code to describe what went wrong and not fully initialize the - // torrent_info object. The overloads that do not take the extra error_code parameter will - // always throw if an error occurs. These overloads are not available when building without - // exception support. + // The overloads that takes an ``error_code const&`` never throws if an + // error occur, they will simply set the error code to describe what went + // wrong and not fully initialize the torrent_info object. The overloads + // that do not take the extra error_code parameter will always throw if + // an error occurs. These overloads are not available when building + // without exception support. // // The ``flags`` argument is currently unused. #ifndef BOOST_NO_EXCEPTIONS diff --git a/set_version.py b/set_version.py index e122d0286..f6192bada 100644 --- a/set_version.py +++ b/set_version.py @@ -18,7 +18,7 @@ def substitute_file(name): elif '#define LIBTORRENT_VERSION ' in l and name.endswith('.hpp'): l = '#define LIBTORRENT_VERSION "%d.%d.%d.%d"\n' % (version[0], version[1], version[2], version[3]) elif 'AC_INIT([libtorrent-rasterbar]' in l and name.endswith('.ac'): - l = 'AC_INIT([libtorrent-rasterbar],[%d.%d.%d],[arvid@rasterbar.com],\n' % (version[0], version[1], version[2]) + l = 'AC_INIT([libtorrent-rasterbar],[%d.%d.%d],[arvid@libtorrent.org],\n' % (version[0], version[1], version[2]) elif 'set (VERSION ' in l and name.endswith('.txt'): l = 'set (VERSION "%d.%d.%d")\n' % (version[0], version[1], version[2]) elif ':Version: ' in l and (name.endswith('.rst') or name.endswith('.py')): diff --git a/test/test_checking.cpp b/test/test_checking.cpp index affec6c77..e74f56c19 100644 --- a/test/test_checking.cpp +++ b/test/test_checking.cpp @@ -49,6 +49,8 @@ enum // make sure we detect corrupt files and mark the appropriate pieces // as not had corrupt_files = 2, + + incomplete_files = 4, }; void test_checking(int flags = read_only_files) @@ -56,16 +58,19 @@ void test_checking(int flags = read_only_files) using namespace libtorrent; namespace lt = libtorrent; - fprintf(stderr, "==== TEST CHECKING %s%s=====\n" + fprintf(stderr, "\n==== TEST CHECKING %s%s%s=====\n\n" , (flags & read_only_files) ? "read-only-files ":"" - , (flags & corrupt_files) ? "corrupt ":""); + , (flags & corrupt_files) ? "corrupt ":"" + , (flags & incomplete_files) ? "incomplete ":""); // make the files writable again for (int i = 0; i < num_files; ++i) { char name[1024]; snprintf(name, sizeof(name), "test%d", i); - std::string path = combine_path("tmp1_checking", "test_torrent_dir"); + char dirname[200]; + snprintf(dirname, sizeof(dirname), "test_dir%d", i / 5); + std::string path = combine_path(combine_path("tmp1_checking", "test_torrent_dir"), dirname); path = combine_path(path, name); #ifdef TORRENT_WINDOWS SetFileAttributesA(path.c_str(), FILE_ATTRIBUTE_NORMAL); @@ -91,7 +96,8 @@ void test_checking(int flags = read_only_files) std::srand(10); int piece_size = 0x4000; - create_random_files(combine_path("tmp1_checking", "test_torrent_dir"), file_sizes, num_files); + create_random_files(combine_path("tmp1_checking", "test_torrent_dir") + , file_sizes, num_files); add_files(fs, combine_path("tmp1_checking", "test_torrent_dir")); libtorrent::create_torrent t(fs, piece_size, 0x4000, libtorrent::create_torrent::optimize); @@ -108,6 +114,28 @@ void test_checking(int flags = read_only_files) fprintf(stderr, "generated torrent: %s tmp1_checking/test_torrent_dir\n" , to_hex(ti->info_hash().to_string()).c_str()); + // truncate every file in half + if (flags & incomplete_files) + { + for (int i = 0; i < num_files; ++i) + { + char name[1024]; + snprintf(name, sizeof(name), "test%d", i); + char dirname[200]; + snprintf(dirname, sizeof(dirname), "test_dir%d", i / 5); + std::string path = combine_path(combine_path("tmp1_checking", "test_torrent_dir"), dirname); + path = combine_path(path, name); + + error_code ec; + file f(path, file::read_write, ec); + if (ec) fprintf(stderr, "ERROR: opening file \"%s\": (%d) %s\n" + , path.c_str(), ec.value(), ec.message().c_str()); + f.set_size(file_sizes[i] / 2, ec); + if (ec) fprintf(stderr, "ERROR: truncating file \"%s\": (%d) %s\n" + , path.c_str(), ec.value(), ec.message().c_str()); + } + } + // overwrite the files with new random data if (flags & corrupt_files) { @@ -175,6 +203,15 @@ void test_checking(int flags = read_only_files) if (!st.error.empty()) break; test_sleep(1000); } + if (flags & incomplete_files) + { + TEST_CHECK(!st.is_seeding); + + test_sleep(500); + st = tor1.status(); + TEST_CHECK(!st.is_seeding); + } + if (flags & corrupt_files) { TEST_CHECK(!st.is_seeding); @@ -204,9 +241,13 @@ void test_checking(int flags = read_only_files) fprintf(stderr, "error: %s\n", st.error.c_str()); } } - else + + if ((flags & (incomplete_files | corrupt_files)) == 0) { TEST_CHECK(st.is_seeding); + if (!st.error.empty()) + fprintf(stderr, "ERROR: %s\n", st.error.c_str()); + TEST_CHECK(st.error.empty()); } // make the files writable again @@ -237,8 +278,9 @@ void test_checking(int flags = read_only_files) int test_main() { test_checking(); - test_checking(read_only_files); test_checking(read_only_files | corrupt_files); + test_checking(read_only_files); + test_checking(incomplete_files); test_checking(corrupt_files); return 0; diff --git a/test/test_web_seed_redirect.cpp b/test/test_web_seed_redirect.cpp index 908ef1113..954e2ecf2 100644 --- a/test/test_web_seed_redirect.cpp +++ b/test/test_web_seed_redirect.cpp @@ -37,11 +37,6 @@ POSSIBILITY OF SUCH DAMAGE. using namespace libtorrent; -const int proxy = libtorrent::settings_pack::none; - -//static unsigned char random_byte() -//{ return std::rand() & 0xff; } - int test_main() { using namespace libtorrent;