Merge branch 'RC_1_1'

This commit is contained in:
arvidn 2016-02-08 15:28:34 -05:00
commit 4f40f84a7e
11 changed files with 101 additions and 77 deletions

View File

@ -1,6 +1,6 @@
ACLOCAL_AMFLAGS = -I m4
#DISTCHECK_CONFIGURE_FLAGS = --enable-tests
AM_DISTCHECK_CONFIGURE_FLAGS = --enable-tests=yes
SUBDIRS = include/libtorrent src examples test bindings tools
@ -94,17 +94,17 @@ DOCS_PAGES = \
docs/utp.rst \
docs/streaming.rst \
docs/reference-Alerts.html \
docs/reference-Bdecoding.html \
docs/reference-Bencoding.html \
docs/reference-Core.html \
docs/reference-Create_Torrents.html \
docs/reference-Custom_Storage.html \
docs/reference-ed25519.html \
docs/reference-Error_Codes.html \
docs/reference-Filter.html \
docs/reference-Plugins.html \
docs/reference-Session.html \
docs/reference-Settings.html \
docs/reference-Storage.html \
docs/reference-Time.html \
docs/reference-Utility.html \
docs/reference.html

5
docs/gen_reference_doc.py Executable file → Normal file
View File

@ -149,7 +149,7 @@ def is_visible(desc):
return True
def highlight_signature(s):
name = s.split('(')
name = s.split('(', 1)
name2 = name[0].split(' ')
if len(name2[-1]) == 0: return s
@ -168,6 +168,9 @@ def highlight_signature(s):
# we also have to escape colons
name[1] = name[1].replace(':', '\\:')
# escape trailing underscores
name[1] = name[1].replace('_', '\\_')
# comments in signatures are italic
name[1] = name[1].replace('/\\*', '*/\\*')
name[1] = name[1].replace('\\*/', '\\*/*')

View File

@ -1298,10 +1298,8 @@ namespace libtorrent
// the type of listen socket this alert refers to.
socket_type_t sock_type;
#ifndef TORRENT_NO_DEPRECATE
// the address and port libtorrent attempted to listen on
tcp::endpoint endpoint;
#endif
private:
aux::stack_allocator const& m_alloc;

View File

@ -1479,10 +1479,11 @@ namespace libtorrent
// its value until the piece picker is created
bool m_sequential_download:1;
// is false by default and set to
// true when the first tracker reponse
// is received
bool m_got_tracker_response:1;
// this is set if the auto_sequential setting is true and this swarm
// satisfies the criteria to be considered high-availability. i.e. if
// there's mostly seeds in the swarm, download the files sequentially
// for improved disk I/O performance.
bool m_auto_sequential:1;
// this means we haven't verified the file content
// of the files we're seeding. the m_verified bitfield
@ -1661,12 +1662,6 @@ namespace libtorrent
// at high enough rates, it's inactive.
bool m_inactive:1;
// this is set if the auto_sequential setting is true and this swarm
// satisfies the criteria to be considered high-availability. i.e. if
// there's mostly seeds in the swarm, download the files sequentially
// for improved disk I/O performance.
bool m_auto_sequential:1;
// ----
// the scrape data from the tracker response, this

View File

@ -1,5 +1,5 @@
# ===========================================================================
# http://www.nongnu.org/autoconf-archive/ax_boost_python.html
# http://www.gnu.org/software/autoconf-archive/ax_boost_python.html
# ===========================================================================
#
# SYNOPSIS
@ -9,7 +9,7 @@
# DESCRIPTION
#
# This macro checks to see if the Boost.Python library is installed. It
# also attempts to guess the currect library name using several attempts.
# also attempts to guess the correct library name using several attempts.
# It tries to build the library name using a user supplied name or suffix
# and then just the raw library.
#
@ -18,20 +18,14 @@
#
# This macro calls AC_SUBST(BOOST_PYTHON_LIB).
#
# In order to ensure that the Python headers are specified on the include
# path, this macro requires AX_PYTHON to be called.
#
# EDIT:
# 2009-09-14 Cristian Greco <cristian.debian@gmail.com>
# - Require AX_PYTHON_DEVEL to be called before this macro to properly
# detect python include path, instead of AX_PYTHON.
# 2009-09-07 Cristian Greco <cristian.debian@gmail.com>
# - Prefix BOOST_PYTHON_LIB with a `-l` for consistency with other
# ax_boost_libname.m4 scripts.
# In order to ensure that the Python headers and the Boost libraries are
# specified on the include path, this macro requires AX_PYTHON_DEVEL and
# AX_BOOST_BASE to be called.
#
# LICENSE
#
# Copyright (c) 2008 Michael Tindal
# Copyright (c) 2013 Daniel M"ullner <daniel@danifold.net>
#
# This program is free software; you can redistribute it and/or modify it
# under the terms of the GNU General Public License as published by the
@ -59,45 +53,69 @@
# modified version of the Autoconf Macro, you may extend this special
# exception to the GPL to apply to your modified version as well.
#serial 21
AC_DEFUN([AX_BOOST_PYTHON],
[AC_REQUIRE([AX_PYTHON_DEVEL])dnl
AC_REQUIRE([AX_BOOST_BASE])dnl
AC_LANG_PUSH([C++])
ax_boost_python_save_CPPFLAGS="$CPPFLAGS"
ax_boost_python_save_LDFLAGS="$LDFLAGS"
ax_boost_python_save_LIBS="$LIBS"
if test "x$PYTHON_CPPFLAGS" != "x"; then
CPPFLAGS="$PYTHON_CPPFLAGS $CPPFLAGS"
fi
# Versions of AX_PYTHON_DEVEL() before serial 18 provided PYTHON_LDFLAGS
# instead of PYTHON_LIBS, so this is just here for compatibility.
if test "x$PYTHON_LDFLAGS" != "x"; then
LDFLAGS="$PYTHON_LDFLAGS $LDFLAGS"
fi
# Note: Only versions of AX_PYTHON_DEVEL() since serial 18 provide PYTHON_LIBS
# instead of PYTHON_LDFLAGS.
if test "x$PYTHON_LIBS" != "x"; then
LIBS="$PYTHON_LIBS $LIBS"
fi
if test "x$BOOST_CPPFLAGS" != "x"; then
CPPFLAGS="$BOOST_CPPFLAGS $CPPFLAGS"
fi
if test "x$BOOST_LDFLAGS" != "x"; then
LDFLAGS="$BOOST_LDFLAGS $LDFLAGS"
fi
AC_CACHE_CHECK(whether the Boost::Python library is available,
ac_cv_boost_python,
[AC_LANG_SAVE
AC_LANG_CPLUSPLUS
CPPFLAGS_SAVE=$CPPFLAGS
if test "x$PYTHON_CPPFLAGS" != "x"; then
CPPFLAGS="$PYTHON_CPPFLAGS $CPPFLAGS"
fi
AC_COMPILE_IFELSE(AC_LANG_PROGRAM([[
#include <boost/python/module.hpp>
using namespace boost::python;
BOOST_PYTHON_MODULE(test) { throw "Boost::Python test."; }]],
[[return 0;]]),
[AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
#include <boost/python/module.hpp>
BOOST_PYTHON_MODULE(test) { throw "Boost::Python test."; }]], [])],
ac_cv_boost_python=yes, ac_cv_boost_python=no)
AC_LANG_RESTORE
CPPFLAGS=$CPPFLAGS_SAVE
])
if test "x$ac_cv_boost_python" = "xyes"; then
AC_DEFINE(HAVE_BOOST_PYTHON,[1],[define if the Boost::Python library is available])
dnl
LDFLAGS_SAVE=$LDFLAGS
if test "x$PYTHON_LDFLAGS" != "x"; then
LDFLAGS="$LDFLAGS $PYTHON_LDFLAGS"
fi
dnl
if test "$ac_cv_boost_python" = "yes"; then
AC_DEFINE(HAVE_BOOST_PYTHON,,[define if the Boost::Python library is available])
ax_python_lib=boost_python
AC_ARG_WITH([boost-python],AS_HELP_STRING([--with-boost-python],[specify the boost python library or suffix to use]),
[if test "x$with_boost_python" != "xno"; then
ax_python_lib="$with_boost_python"
ax_boost_python_lib="boost_python-$with_boost_python"
AC_ARG_WITH([boost-python],AS_HELP_STRING([--with-boost-python],[specify yes/no or the boost python library or suffix to use]),
[if test "x$with_boost_python" != "xno" -a "x$with_boost_python" != "xyes"; then
ax_python_lib=$with_boost_python
ax_boost_python_lib=boost_python-$with_boost_python
fi])
for ax_lib in $ax_python_lib $ax_boost_python_lib boost_python; do
AC_CHECK_LIB($ax_lib, main, [BOOST_PYTHON_LIB=-l$ax_lib break])
BOOSTLIBDIR=`echo $BOOST_LDFLAGS | sed -e 's/@<:@^\/@:>@*//'`
for ax_lib in $ax_python_lib $ax_boost_python_lib `ls $BOOSTLIBDIR/libboost_python*.so* $BOOSTLIBDIR/libboost_python*.dylib* $BOOSTLIBDIR/libboost_python*.a* 2>/dev/null | sed 's,.*/,,' | sed -e 's;^lib\(boost_python.*\)\.so.*$;\1;' -e 's;^lib\(boost_python.*\)\.dylib.*$;\1;' -e 's;^lib\(boost_python.*\)\.a.*$;\1;' ` boost_python boost_python3; do
AS_VAR_PUSHDEF([ax_Lib], [ax_cv_lib_$ax_lib''_BOOST_PYTHON_MODULE])dnl
AC_CACHE_CHECK([whether $ax_lib is the correct library], [ax_Lib],
[LIBS="-l$ax_lib $ax_boost_python_save_LIBS $PYTHON_LIBS"
AC_LINK_IFELSE([AC_LANG_PROGRAM([[
#include <boost/python/module.hpp>
BOOST_PYTHON_MODULE(test) { throw "Boost::Python test."; }]], [])],
[AS_VAR_SET([ax_Lib], [yes])],
[AS_VAR_SET([ax_Lib], [no])])])
AS_VAR_IF([ax_Lib], [yes], [BOOST_PYTHON_LIB=$ax_lib break], [])
AS_VAR_POPDEF([ax_Lib])dnl
done
dnl
LDFLAGS=$LDFLAGS_SAVE
dnl
AC_SUBST(BOOST_PYTHON_LIB)
fi
CPPFLAGS="$ax_boost_python_save_CPPFLAGS"
LDFLAGS="$ax_boost_python_save_LDFLAGS"
LIBS="$ax_boost_python_save_LIBS"
AC_LANG_POP([C++])
])dnl

View File

@ -787,14 +787,12 @@ namespace libtorrent {
"SSL/uTP"
};
#ifndef TORRENT_NO_DEPRECATE
tcp::endpoint parse_interface(std::string const& iface, int port)
{
// ignore errors
error_code ec;
return tcp::endpoint(address::from_string(iface, ec), port);
}
#endif
}
listen_failed_alert::listen_failed_alert(
@ -808,9 +806,7 @@ namespace libtorrent {
, operation(op)
, port(prt)
, sock_type(t)
#ifndef TORRENT_NO_DEPRECATE
, endpoint(parse_interface(iface, prt))
#endif
, m_alloc(alloc)
, m_interface_idx(alloc.copy_string(iface))
{}

View File

@ -4780,6 +4780,10 @@ retry:
torrent_ptr = boost::make_shared<torrent>(boost::ref(*this)
, 16 * 1024, queue_pos, boost::cref(params), boost::cref(*ih));
if (m_alerts.should_post<torrent_added_alert>())
m_alerts.emplace_alert<torrent_added_alert>(torrent_ptr->get_handle());
torrent_ptr->set_ip_filter(m_ip_filter);
torrent_ptr->start(params);
@ -4859,9 +4863,6 @@ retry:
m_uuids.insert(std::make_pair(params.uuid.empty()
? params.url : params.uuid, torrent_ptr));
if (m_alerts.should_post<torrent_added_alert>())
m_alerts.emplace_alert<torrent_added_alert>(torrent_ptr->get_handle());
// recalculate auto-managed torrents sooner (or put it off)
// if another torrent will be added within one second from now
// we want to put it off again anyway. So that while we're adding
@ -5870,7 +5871,7 @@ retry:
#ifdef TORRENT_USE_OPENSSL
m_ssl_udp_socket.unsubscribe(this);
m_ssl_udp_socket.unsubscribe(&m_utp_socket_manager);
m_ssl_udp_socket.unsubscribe(&m_ssl_utp_socket_manager);
#endif
TORRENT_ASSERT(m_torrents.empty());
@ -5994,6 +5995,8 @@ retry:
}
#endif
// TODO: 2 this should be factored into the udp socket, so we only have the
// code once
void session_impl::update_peer_tos()
{
error_code ec;

View File

@ -234,7 +234,7 @@ namespace libtorrent
, m_last_working_tracker(-1)
, m_finished_time(0)
, m_sequential_download(false)
, m_got_tracker_response(false)
, m_auto_sequential(false)
, m_seed_mode(false)
, m_super_seeding(false)
, m_override_resume_data((p.flags & add_torrent_params::flag_override_resume_data) != 0)
@ -274,7 +274,6 @@ namespace libtorrent
, m_current_gauge_state(no_gauge_state)
, m_moving_storage(false)
, m_inactive(false)
, m_auto_sequential(false)
, m_downloaded(0xffffff)
, m_last_scrape((std::numeric_limits<boost::int16_t>::min)())
, m_progress_ppm(0)
@ -3565,7 +3564,6 @@ namespace libtorrent
#endif
, r.url);
}
m_got_tracker_response = true;
// we're listening on an interface type that was not used
// when talking to the tracker. If there is a matching interface
@ -5978,18 +5976,27 @@ namespace libtorrent
if (alerts().should_post<torrent_error_alert>())
alerts().emplace_alert<torrent_error_alert>(get_handle(), ec, certificate);
}
#ifndef TORRENT_DISABLE_LOGGING
debug_log("*** use certificate file: %s", ec.message().c_str());
#endif
m_ssl_ctx->use_private_key_file(private_key, context::pem, ec);
if (ec)
{
if (alerts().should_post<torrent_error_alert>())
alerts().emplace_alert<torrent_error_alert>(get_handle(), ec, private_key);
}
#ifndef TORRENT_DISABLE_LOGGING
debug_log("*** use private key file: %s", ec.message().c_str());
#endif
m_ssl_ctx->use_tmp_dh_file(dh_params, ec);
if (ec)
{
if (alerts().should_post<torrent_error_alert>())
alerts().emplace_alert<torrent_error_alert>(get_handle(), ec, dh_params);
}
#ifndef TORRENT_DISABLE_LOGGING
debug_log("*** use DH file: %s", ec.message().c_str());
#endif
}
void torrent::set_ssl_cert_buffer(std::string const& certificate

View File

@ -820,9 +820,9 @@ void udp_socket::bind(udp::endpoint const& ep, error_code& ec)
// this is best-effort. ignore errors
error_code err;
#ifdef TORRENT_WINDOWS
m_ipv4_sock.set_option(exclusive_address_use(true), err);
m_ipv6_sock.set_option(exclusive_address_use(true), err);
#endif
m_ipv4_sock.set_option(boost::asio::socket_base::reuse_address(true), err);
m_ipv6_sock.set_option(boost::asio::socket_base::reuse_address(true), err);
m_ipv6_sock.set_option(boost::asio::ip::v6_only(true), err);
m_ipv6_sock.bind(ep6, ec);

View File

@ -101,7 +101,7 @@ 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
test_utils.hpp settings.hpp make_torrent.hpp
libtest_la_SOURCES = main.cpp \
test.cpp \
@ -109,6 +109,7 @@ libtest_la_SOURCES = main.cpp \
dht_server.cpp \
udp_tracker.cpp \
peer_server.cpp \
make_torrent.cpp \
web_seed_suite.cpp \
swarm_suite.cpp \
test_utils.cpp \

View File

@ -155,6 +155,8 @@ alert const* wait_for_alert(lt::session& ses, int type, char const* name)
time_point now = clock_type::now();
if (now > end) return NULL;
alert const* ret = NULL;
ses.wait_for_alert(end - now);
std::vector<alert*> alerts;
ses.pop_alerts(&alerts);
@ -163,11 +165,12 @@ alert const* wait_for_alert(lt::session& ses, int type, char const* name)
{
fprintf(stderr, "%s: %s: [%s] %s\n", time_now_string(), name
, (*i)->what(), (*i)->message().c_str());
if ((*i)->type() == type)
if ((*i)->type() == type && !ret)
{
return *i;
ret = *i;
}
}
if (ret) return ret;
}
return NULL;
}