merged RC_1_1 into master
This commit is contained in:
commit
42b3fbe20a
|
@ -28,6 +28,7 @@
|
||||||
|
|
||||||
1.1.1 release
|
1.1.1 release
|
||||||
|
|
||||||
|
* fix piece picker bug that could result in division by zero
|
||||||
* fix value of current_tracker when all tracker failed
|
* fix value of current_tracker when all tracker failed
|
||||||
* deprecate lt_trackers extension
|
* deprecate lt_trackers extension
|
||||||
* remove load_asnum_db and load_country_db from python bindings
|
* remove load_asnum_db and load_country_db from python bindings
|
||||||
|
|
4
Jamfile
4
Jamfile
|
@ -555,8 +555,8 @@ lib libiconv : : <name>iconv <link>shared <search>/usr/local/lib ;
|
||||||
# openssl on linux/bsd/macos etc.
|
# openssl on linux/bsd/macos etc.
|
||||||
lib gcrypt : : <name>gcrypt <link>shared <search>/opt/local/lib <search>/usr/local/lib : : <include>/opt/local/include <include>/usr/local/include ;
|
lib gcrypt : : <name>gcrypt <link>shared <search>/opt/local/lib <search>/usr/local/lib : : <include>/opt/local/include <include>/usr/local/include ;
|
||||||
lib z : : <link>shared <name>z <search>/usr/lib ;
|
lib z : : <link>shared <name>z <search>/usr/lib ;
|
||||||
lib crypto : : <name>crypto <link>shared <use>z <search>/opt/local/lib <search>/usr/local/lib : : <include>/opt/local/include <include>/usr/local/include ;
|
lib crypto : : <name>crypto <link>shared <use>z <search>/opt/local/lib : : <include>/opt/local/include ;
|
||||||
lib ssl : : <name>ssl <link>shared <use>crypto <search>/opt/local/lib <search>/usr/local/lib : : <include>/opt/local/include <include>/usr/local/include ;
|
lib ssl : : <name>ssl <link>shared <use>crypto <search>/opt/local/lib : : <include>/opt/local/include ;
|
||||||
lib dl : : <link>shared <name>dl ;
|
lib dl : : <link>shared <name>dl ;
|
||||||
|
|
||||||
# time functions used on linux require librt
|
# time functions used on linux require librt
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
#!/usr/bin/env python
|
#!/usr/bin/env python
|
||||||
|
|
||||||
from distutils.core import setup, Extension
|
from distutils.core import setup, Extension
|
||||||
from distutils.sysconfig import get_config_var
|
from distutils.sysconfig import get_config_vars
|
||||||
import os
|
import os
|
||||||
import platform
|
import platform
|
||||||
import sys
|
import sys
|
||||||
|
@ -98,8 +98,10 @@ if '--bjam' in sys.argv:
|
||||||
|
|
||||||
else:
|
else:
|
||||||
# Remove the '-Wstrict-prototypes' compiler option, which isn't valid for C++.
|
# Remove the '-Wstrict-prototypes' compiler option, which isn't valid for C++.
|
||||||
os.environ['OPT'] = ' '.join(
|
cfg_vars = get_config_vars()
|
||||||
flag for flag in get_config_var('OPT').split() if flag != '-Wstrict-prototypes')
|
for key, value in cfg_vars.items():
|
||||||
|
if isinstance(value, str):
|
||||||
|
cfg_vars[key] = value.replace('-Wstrict-prototypes', '')
|
||||||
|
|
||||||
source_list = os.listdir(os.path.join(os.path.dirname(__file__), "src"))
|
source_list = os.listdir(os.path.join(os.path.dirname(__file__), "src"))
|
||||||
source_list = [os.path.abspath(os.path.join(os.path.dirname(__file__), "src", s)) for s in source_list if s.endswith(".cpp")]
|
source_list = [os.path.abspath(os.path.join(os.path.dirname(__file__), "src", s)) for s in source_list if s.endswith(".cpp")]
|
||||||
|
|
|
@ -45,6 +45,15 @@ struct entry_to_python
|
||||||
return convert(e.list());
|
return convert(e.list());
|
||||||
case entry::dictionary_t:
|
case entry::dictionary_t:
|
||||||
return convert(e.dict());
|
return convert(e.dict());
|
||||||
|
case entry::preformatted_t:
|
||||||
|
{
|
||||||
|
std::vector<char> const& pre = e.preformatted();
|
||||||
|
list l;
|
||||||
|
for (std::vector<char>::const_iterator i = pre.begin()
|
||||||
|
, end(pre.end()); i != end; ++i)
|
||||||
|
l.append(*i);
|
||||||
|
return tuple(l);
|
||||||
|
}
|
||||||
default:
|
default:
|
||||||
return object();
|
return object();
|
||||||
}
|
}
|
||||||
|
@ -136,6 +145,19 @@ struct entry_from_python
|
||||||
{
|
{
|
||||||
return entry(extract<entry::integer_type>(e)());
|
return entry(extract<entry::integer_type>(e)());
|
||||||
}
|
}
|
||||||
|
else if (extract<tuple>(e).check())
|
||||||
|
{
|
||||||
|
tuple t = extract<tuple>(e);
|
||||||
|
|
||||||
|
std::size_t const length = extract<std::size_t>(t.attr("__len__")());
|
||||||
|
std::vector<char> preformatted(length);
|
||||||
|
for (std::size_t i = 0; i < length; ++i)
|
||||||
|
{
|
||||||
|
preformatted[i] = extract<char>(t[i]);
|
||||||
|
}
|
||||||
|
|
||||||
|
return entry(preformatted);
|
||||||
|
}
|
||||||
|
|
||||||
return entry();
|
return entry();
|
||||||
}
|
}
|
||||||
|
|
|
@ -8,6 +8,20 @@ import os
|
||||||
import shutil
|
import shutil
|
||||||
import binascii
|
import binascii
|
||||||
|
|
||||||
|
|
||||||
|
class test_create_torrent(unittest.TestCase):
|
||||||
|
|
||||||
|
def test_from_torrent_info(self):
|
||||||
|
ti = lt.torrent_info('unordered.torrent')
|
||||||
|
ct = lt.create_torrent(ti)
|
||||||
|
entry = ct.generate()
|
||||||
|
content = lt.bencode(entry).strip()
|
||||||
|
with open('unordered.torrent', 'r') as f:
|
||||||
|
file_content = f.read().strip()
|
||||||
|
print file_content
|
||||||
|
print content
|
||||||
|
self.assertEqual(content, file_content)
|
||||||
|
|
||||||
class test_torrent_handle(unittest.TestCase):
|
class test_torrent_handle(unittest.TestCase):
|
||||||
|
|
||||||
def test_torrent_handle(self):
|
def test_torrent_handle(self):
|
||||||
|
@ -191,5 +205,6 @@ if __name__ == '__main__':
|
||||||
print(lt.__version__)
|
print(lt.__version__)
|
||||||
shutil.copy(os.path.join('..', '..', 'test', 'test_torrents', 'url_seed_multi.torrent'), '.')
|
shutil.copy(os.path.join('..', '..', 'test', 'test_torrents', 'url_seed_multi.torrent'), '.')
|
||||||
shutil.copy(os.path.join('..', '..', 'test', 'test_torrents', 'base.torrent'), '.')
|
shutil.copy(os.path.join('..', '..', 'test', 'test_torrents', 'base.torrent'), '.')
|
||||||
|
shutil.copy(os.path.join('..', '..', 'test', 'test_torrents', 'unordered.torrent'), '.')
|
||||||
unittest.main()
|
unittest.main()
|
||||||
|
|
||||||
|
|
|
@ -33,7 +33,7 @@
|
||||||
# and this notice are preserved. This file is offered as-is, without any
|
# and this notice are preserved. This file is offered as-is, without any
|
||||||
# warranty.
|
# warranty.
|
||||||
|
|
||||||
#serial 22
|
#serial 26
|
||||||
|
|
||||||
AC_DEFUN([AX_BOOST_BASE],
|
AC_DEFUN([AX_BOOST_BASE],
|
||||||
[
|
[
|
||||||
|
@ -92,8 +92,11 @@ if test "x$want_boost" = "xyes"; then
|
||||||
libsubdirs="lib"
|
libsubdirs="lib"
|
||||||
ax_arch=`uname -m`
|
ax_arch=`uname -m`
|
||||||
case $ax_arch in
|
case $ax_arch in
|
||||||
x86_64|ppc64|s390x|sparc64|aarch64)
|
x86_64)
|
||||||
libsubdirs="lib64 lib lib64"
|
libsubdirs="lib64 libx32 lib lib64"
|
||||||
|
;;
|
||||||
|
ppc64|s390x|sparc64|aarch64|ppc64le)
|
||||||
|
libsubdirs="lib64 lib lib64 ppc64le"
|
||||||
;;
|
;;
|
||||||
esac
|
esac
|
||||||
|
|
||||||
|
@ -103,6 +106,12 @@ if test "x$want_boost" = "xyes"; then
|
||||||
AC_REQUIRE([AC_CANONICAL_HOST])
|
AC_REQUIRE([AC_CANONICAL_HOST])
|
||||||
libsubdirs="lib/${host_cpu}-${host_os} $libsubdirs"
|
libsubdirs="lib/${host_cpu}-${host_os} $libsubdirs"
|
||||||
|
|
||||||
|
case ${host_cpu} in
|
||||||
|
i?86)
|
||||||
|
libsubdirs="lib/i386-${host_os} $libsubdirs"
|
||||||
|
;;
|
||||||
|
esac
|
||||||
|
|
||||||
dnl first we check the system location for boost libraries
|
dnl first we check the system location for boost libraries
|
||||||
dnl this location ist chosen if boost libraries are installed with the --layout=system option
|
dnl this location ist chosen if boost libraries are installed with the --layout=system option
|
||||||
dnl or if you install boost with RPM
|
dnl or if you install boost with RPM
|
||||||
|
@ -164,6 +173,10 @@ if test "x$want_boost" = "xyes"; then
|
||||||
dnl if we found no boost with system layout we search for boost libraries
|
dnl if we found no boost with system layout we search for boost libraries
|
||||||
dnl built and installed without the --layout=system option or for a staged(not installed) version
|
dnl built and installed without the --layout=system option or for a staged(not installed) version
|
||||||
if test "x$succeeded" != "xyes"; then
|
if test "x$succeeded" != "xyes"; then
|
||||||
|
CPPFLAGS="$CPPFLAGS_SAVED"
|
||||||
|
LDFLAGS="$LDFLAGS_SAVED"
|
||||||
|
BOOST_CPPFLAGS=
|
||||||
|
BOOST_LDFLAGS=
|
||||||
_version=0
|
_version=0
|
||||||
if test "$ac_boost_path" != ""; then
|
if test "$ac_boost_path" != ""; then
|
||||||
if test -d "$ac_boost_path" && test -r "$ac_boost_path"; then
|
if test -d "$ac_boost_path" && test -r "$ac_boost_path"; then
|
||||||
|
@ -176,6 +189,12 @@ if test "x$want_boost" = "xyes"; then
|
||||||
VERSION_UNDERSCORE=`echo $_version | sed 's/\./_/'`
|
VERSION_UNDERSCORE=`echo $_version | sed 's/\./_/'`
|
||||||
BOOST_CPPFLAGS="-I$ac_boost_path/include/boost-$VERSION_UNDERSCORE"
|
BOOST_CPPFLAGS="-I$ac_boost_path/include/boost-$VERSION_UNDERSCORE"
|
||||||
done
|
done
|
||||||
|
dnl if nothing found search for layout used in Windows distributions
|
||||||
|
if test -z "$BOOST_CPPFLAGS"; then
|
||||||
|
if test -d "$ac_boost_path/boost" && test -r "$ac_boost_path/boost"; then
|
||||||
|
BOOST_CPPFLAGS="-I$ac_boost_path"
|
||||||
|
fi
|
||||||
|
fi
|
||||||
fi
|
fi
|
||||||
else
|
else
|
||||||
if test "$cross_compiling" != yes; then
|
if test "$cross_compiling" != yes; then
|
||||||
|
|
|
@ -101,12 +101,11 @@ if test "$ac_cv_boost_python" = "yes"; then
|
||||||
fi])
|
fi])
|
||||||
BOOSTLIBDIR=`echo $BOOST_LDFLAGS | sed -e 's/@<:@^\/@:>@*//'`
|
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
|
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
|
AS_VAR_PUSHDEF([ax_Lib], [ax_cv_lib_$ax_lib''_main])dnl
|
||||||
AC_CACHE_CHECK([whether $ax_lib is the correct library], [ax_Lib],
|
AC_CACHE_CHECK([whether $ax_lib is the correct library], [ax_Lib],
|
||||||
[LIBS="-l$ax_lib $ax_boost_python_save_LIBS $PYTHON_LIBS"
|
[LIBS="-l$ax_lib $ax_boost_python_save_LIBS $PYTHON_LIBS"
|
||||||
AC_LINK_IFELSE([AC_LANG_PROGRAM([[
|
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], [yes])],
|
||||||
[AS_VAR_SET([ax_Lib], [no])])])
|
[AS_VAR_SET([ax_Lib], [no])])])
|
||||||
AS_VAR_IF([ax_Lib], [yes], [BOOST_PYTHON_LIB=$ax_lib break], [])
|
AS_VAR_IF([ax_Lib], [yes], [BOOST_PYTHON_LIB=$ax_lib break], [])
|
||||||
|
|
|
@ -136,7 +136,7 @@ variable to configure. See ``configure --help'' for reference.
|
||||||
# Check if you have distutils, else fail
|
# Check if you have distutils, else fail
|
||||||
#
|
#
|
||||||
AC_MSG_CHECKING([for the distutils Python package])
|
AC_MSG_CHECKING([for the distutils Python package])
|
||||||
ac_distutils_result=`$PYTHON -c "import distutils" 2>&1`
|
ac_distutils_result=`$PYTHON -c "import distutils" 2>&1 | grep -v '^\[[0-9]\{1,\} refs\]'`
|
||||||
if test -z "$ac_distutils_result"; then
|
if test -z "$ac_distutils_result"; then
|
||||||
AC_MSG_RESULT([yes])
|
AC_MSG_RESULT([yes])
|
||||||
else
|
else
|
||||||
|
|
|
@ -118,8 +118,8 @@ namespace libtorrent
|
||||||
m_cache_pool = nullptr;
|
m_cache_pool = nullptr;
|
||||||
// attempt to make MacOS not flush this to disk, making close()
|
// attempt to make MacOS not flush this to disk, making close()
|
||||||
// block for a long time
|
// block for a long time
|
||||||
int ignore = ftruncate(m_cache_fd, 0);
|
int const best_effort = ftruncate(m_cache_fd, 0);
|
||||||
TORRENT_UNUSED(ignore);
|
TORRENT_UNUSED(best_effort);
|
||||||
close(m_cache_fd);
|
close(m_cache_fd);
|
||||||
m_cache_fd = -1;
|
m_cache_fd = -1;
|
||||||
}
|
}
|
||||||
|
@ -462,8 +462,8 @@ namespace libtorrent
|
||||||
m_cache_pool = nullptr;
|
m_cache_pool = nullptr;
|
||||||
// attempt to make MacOS not flush this to disk, making close()
|
// attempt to make MacOS not flush this to disk, making close()
|
||||||
// block for a long time
|
// block for a long time
|
||||||
int ignore = ftruncate(m_cache_fd, 0);
|
int const best_effort = ftruncate(m_cache_fd, 0);
|
||||||
TORRENT_UNUSED(ignore);
|
TORRENT_UNUSED(best_effort);
|
||||||
close(m_cache_fd);
|
close(m_cache_fd);
|
||||||
m_cache_fd = -1;
|
m_cache_fd = -1;
|
||||||
std::vector<int>().swap(m_free_list);
|
std::vector<int>().swap(m_free_list);
|
||||||
|
@ -503,8 +503,8 @@ namespace libtorrent
|
||||||
m_cache_pool = nullptr;
|
m_cache_pool = nullptr;
|
||||||
// attempt to make MacOS not flush this to disk, making close()
|
// attempt to make MacOS not flush this to disk, making close()
|
||||||
// block for a long time
|
// block for a long time
|
||||||
int ignore = ftruncate(m_cache_fd, 0);
|
int const best_effort2 = ftruncate(m_cache_fd, 0);
|
||||||
TORRENT_UNUSED(ignore);
|
TORRENT_UNUSED(best_effort2);
|
||||||
close(m_cache_fd);
|
close(m_cache_fd);
|
||||||
m_cache_fd = -1;
|
m_cache_fd = -1;
|
||||||
return;
|
return;
|
||||||
|
|
|
@ -330,14 +330,14 @@ namespace libtorrent
|
||||||
// don't hold the lock during disk I/O
|
// don't hold the lock during disk I/O
|
||||||
l.unlock();
|
l.unlock();
|
||||||
|
|
||||||
file::iovec_t const v = { buf.get(), size_t(block_to_copy) };
|
file::iovec_t v = { buf.get(), size_t(block_to_copy) };
|
||||||
int ret = m_file.readv(slot_offset + piece_offset, &v, 1, ec);
|
v.iov_len = m_file.readv(slot_offset + piece_offset, &v, 1, ec);
|
||||||
TORRENT_ASSERT(ec || ret == block_to_copy);
|
TORRENT_ASSERT(!ec);
|
||||||
if (ec || ret != block_to_copy) return;
|
if (ec || v.iov_len == 0) return;
|
||||||
|
|
||||||
ret = f.writev(file_offset, &v, 1, ec);
|
boost::int64_t ret = f.writev(file_offset, &v, 1, ec);
|
||||||
TORRENT_ASSERT(ec || ret == block_to_copy);
|
TORRENT_ASSERT(ec || ret == v.iov_len);
|
||||||
if (ec || ret != block_to_copy) return;
|
if (ec || ret != v.iov_len) return;
|
||||||
|
|
||||||
// we're done with the disk I/O, grab the lock again to update
|
// we're done with the disk I/O, grab the lock again to update
|
||||||
// the slot map
|
// the slot map
|
||||||
|
|
|
@ -93,6 +93,7 @@ EXTRA_DIST = Jamfile \
|
||||||
test_torrents/string.torrent \
|
test_torrents/string.torrent \
|
||||||
test_torrents/symlink1.torrent \
|
test_torrents/symlink1.torrent \
|
||||||
test_torrents/unaligned_pieces.torrent \
|
test_torrents/unaligned_pieces.torrent \
|
||||||
|
test_torrents/unordered.torrent \
|
||||||
test_torrents/url_list.torrent \
|
test_torrents/url_list.torrent \
|
||||||
test_torrents/url_list2.torrent \
|
test_torrents/url_list2.torrent \
|
||||||
test_torrents/url_list3.torrent \
|
test_torrents/url_list3.torrent \
|
||||||
|
|
|
@ -127,6 +127,7 @@ static test_torrent_t test_torrents[] =
|
||||||
{ "invalid_name2.torrent" },
|
{ "invalid_name2.torrent" },
|
||||||
{ "invalid_name3.torrent" },
|
{ "invalid_name3.torrent" },
|
||||||
{ "symlink1.torrent" },
|
{ "symlink1.torrent" },
|
||||||
|
{ "unordered.torrent" },
|
||||||
};
|
};
|
||||||
|
|
||||||
struct test_failing_torrent_t
|
struct test_failing_torrent_t
|
||||||
|
|
|
@ -0,0 +1 @@
|
||||||
|
d10:created by10:libtorrent13:creation datei1359599503e4:infod4:name4:temp6:lengthi425e12:piece lengthi16384e6:pieces20:‚ž¼Œ&¾ÇJW›}ÜA4u,·¼‘‡ee
|
Loading…
Reference in New Issue