merged changes from RC_1_0

This commit is contained in:
Arvid Norberg 2014-10-22 07:05:10 +00:00
parent 8d99b6eabb
commit 907dc9dddd
14 changed files with 85 additions and 39 deletions

View File

@ -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

View File

@ -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

View File

@ -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',

View File

@ -41,7 +41,7 @@
<tr><th class="docinfo-name">Author:</th>
<td>Arvid Norberg, <a class="last reference external" href="mailto:arvid&#64;libtorrent.org">arvid&#64;libtorrent.org</a></td></tr>
<tr><th class="docinfo-name">Version:</th>
<td>1.0.2</td></tr>
<td>1.0.3</td></tr>
</tbody>
</table>
<div class="contents topic" id="table-of-contents">

View File

@ -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

View File

@ -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

View File

@ -41,7 +41,7 @@
<tr><th class="docinfo-name">Author:</th>
<td>Arvid Norberg, <a class="last reference external" href="mailto:arvid&#64;libtorrent.org">arvid&#64;libtorrent.org</a></td></tr>
<tr><th class="docinfo-name">Version:</th>
<td>1.0.2</td></tr>
<td>1.0.3</td></tr>
</tbody>
</table>
<div id="librarySidebar"><ul class="simple">

View File

@ -1,5 +1,5 @@
:Author: Arvid Norberg, arvid@libtorrent.org
:Version: 1.0.2
:Version: 1.1.0
.. raw:: html

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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')):

View File

@ -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;

View File

@ -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;