merged RC_1_1 into master

This commit is contained in:
arvidn 2018-01-08 22:28:18 +01:00
commit ad82be145b
4 changed files with 25 additions and 15 deletions

View File

@ -109,7 +109,7 @@ with an associated port.
For documentation on these types, please refer to the `asio documentation`_.
.. _`asio documentation`: http://asio.sourceforge.net/asio-0.3.8/doc/asio/reference.html
.. _`asio documentation`: http://www.boost.org/doc/libs/1_66_0/doc/html/boost_asio.html
exceptions
==========

View File

@ -33,8 +33,6 @@ POSSIBILITY OF SUCH DAMAGE.
#ifndef TORRENT_FWD_HPP
#define TORRENT_FWD_HPP
#include "libtorrent/export.hpp"
namespace libtorrent {
// include/libtorrent/add_torrent_params.hpp
@ -185,6 +183,12 @@ class hasher512;
struct ip_filter;
class port_filter;
// include/libtorrent/peer_class.hpp
struct peer_class_info;
// include/libtorrent/peer_class_type_filter.hpp
struct peer_class_type_filter;
// include/libtorrent/peer_connection_handle.hpp
struct peer_connection_handle;
struct bt_peer_connection_handle;
@ -203,9 +207,6 @@ class session;
// include/libtorrent/session_handle.hpp
struct session_handle;
// include/libtorrent/session_settings.hpp
struct pe_settings;
// include/libtorrent/session_stats.hpp
struct stats_metric;
@ -265,8 +266,13 @@ struct internal_file_entry;
struct pascal_string;
struct lazy_entry;
// include/libtorrent/session_settings.hpp
struct pe_settings;
#endif // TORRENT_NO_DEPRECATE
}
namespace lt = libtorrent;
#endif // TORRENT_FWD_HPP

View File

@ -328,16 +328,20 @@ namespace {
// a piece_size of 0 means automatic
if (piece_size == 0 && !m_merkle_torrent)
{
const int target_size = 40 * 1024;
piece_size = int(fs.total_size() / (target_size / 20));
// size_table is computed from the following:
// target_list_size = sqrt(total_size) * 2;
// target_piece_size = total_size / (target_list_size / hash_size);
// Given hash_size = 20 bytes, target_piece_size = (16*1024 * pow(2, i))
// we can determine size_table = (total_size = pow(2 * target_piece_size / hash_size, 2))
std::int64_t const size_table[] = {2684355, 10737418, 42949673, 171798692, 687194767,
2748779069LL, 10995116278LL, 43980465111LL, 175921860444LL, 703687441777LL};
int i = 16*1024;
for (; i < 2*1024*1024; i *= 2)
int i = 0;
for (int max = sizeof(size_table) / sizeof(size_table[0]); i < max; ++i)
{
if (piece_size > i) continue;
break;
if (size_table[i] >= fs.total_size()) break;
}
piece_size = i;
piece_size = 0x4000 << i;
}
else if (piece_size == 0 && m_merkle_torrent)
{

View File

@ -38,8 +38,6 @@ POSSIBILITY OF SUCH DAMAGE.
#ifndef TORRENT_FWD_HPP
#define TORRENT_FWD_HPP
#include "libtorrent/export.hpp"
namespace libtorrent {
'''
@ -47,6 +45,8 @@ file_footer = '''
}
namespace lt = libtorrent;
#endif // TORRENT_FWD_HPP
'''