merged RC_1_1 into master

This commit is contained in:
arvidn 2017-09-03 13:57:19 +02:00
commit fe1c395579
6 changed files with 60 additions and 17 deletions

View File

@ -312,10 +312,10 @@ namespace aux {
// this is set when the piece should be evicted as soon as there // this is set when the piece should be evicted as soon as there
// no longer are any references to it. Evicted here means demoted // no longer are any references to it. Evicted here means demoted
// to a ghost list // to a ghost list
boost::uint32_t marked_for_eviction:1; std::uint32_t marked_for_eviction:1;
// the number of blocks that have >= 1 refcount // the number of blocks that have >= 1 refcount
boost::uint32_t pinned:15; std::uint32_t pinned:15;
// ---- 32 bit boundary --- // ---- 32 bit boundary ---

View File

@ -134,8 +134,11 @@ struct picker_log_alert;
struct session_error_alert; struct session_error_alert;
struct dht_live_nodes_alert; struct dht_live_nodes_alert;
struct session_stats_header_alert; struct session_stats_header_alert;
struct dht_sample_infohashes_alert;
struct block_uploaded_alert;
// include/libtorrent/announce_entry.hpp // include/libtorrent/announce_entry.hpp
struct announce_endpoint;
struct announce_entry; struct announce_entry;
// include/libtorrent/bdecode.hpp // include/libtorrent/bdecode.hpp
@ -182,13 +185,6 @@ class hasher512;
struct ip_filter; struct ip_filter;
class port_filter; class port_filter;
// include/libtorrent/kademlia/dht_state.hpp
struct dht_state;
// include/libtorrent/kademlia/dht_storage.hpp
struct dht_storage_counters;
struct dht_storage_interface;
// include/libtorrent/peer_connection_handle.hpp // include/libtorrent/peer_connection_handle.hpp
struct peer_connection_handle; struct peer_connection_handle;
struct bt_peer_connection_handle; struct bt_peer_connection_handle;
@ -241,11 +237,23 @@ class torrent_info;
// include/libtorrent/torrent_status.hpp // include/libtorrent/torrent_status.hpp
struct torrent_status; struct torrent_status;
namespace dht {
// include/libtorrent/kademlia/dht_state.hpp
struct dht_state;
// include/libtorrent/kademlia/dht_storage.hpp
struct dht_storage_counters;
struct dht_storage_interface;
}
#ifndef TORRENT_NO_DEPRECATE #ifndef TORRENT_NO_DEPRECATE
// include/libtorrent/alert_types.hpp // include/libtorrent/alert_types.hpp
struct torrent_added_alert; struct torrent_added_alert;
struct mmap_cache_alert; struct mmap_cache_alert;
struct torrent_update_alert;
// include/libtorrent/file_storage.hpp // include/libtorrent/file_storage.hpp
struct file_entry; struct file_entry;

View File

@ -937,21 +937,21 @@ namespace libtorrent {
DLOG("try_flush_write_blocks: %d\n", num); DLOG("try_flush_write_blocks: %d\n", num);
list_iterator<cached_piece_entry> range = m_disk_cache.write_lru_pieces(); list_iterator<cached_piece_entry> range = m_disk_cache.write_lru_pieces();
aux::vector<std::pair<storage_interface*, piece_index_t>> pieces; aux::vector<std::pair<std::shared_ptr<storage_interface>, piece_index_t>> pieces;
pieces.reserve(m_disk_cache.num_write_lru_pieces()); pieces.reserve(m_disk_cache.num_write_lru_pieces());
for (list_iterator<cached_piece_entry> p = range; p.get() && num > 0; p.next()) for (list_iterator<cached_piece_entry> p = range; p.get() && num > 0; p.next())
{ {
cached_piece_entry* e = p.get(); cached_piece_entry* e = p.get();
if (e->num_dirty == 0) continue; if (e->num_dirty == 0) continue;
pieces.push_back(std::make_pair(e->storage.get(), e->piece)); pieces.push_back(std::make_pair(e->storage, e->piece));
} }
for (auto const& p : pieces) for (auto const& p : pieces)
{ {
// TODO: instead of doing a lookup each time through the loop, save // TODO: instead of doing a lookup each time through the loop, save
// cached_piece_entry pointers with piece_refcount incremented to pin them // cached_piece_entry pointers with piece_refcount incremented to pin them
cached_piece_entry* pe = m_disk_cache.find_piece(p.first, p.second); cached_piece_entry* pe = m_disk_cache.find_piece(p.first.get(), p.second);
if (pe == nullptr) continue; if (pe == nullptr) continue;
// another thread may flush this piece while we're looping and // another thread may flush this piece while we're looping and
@ -980,7 +980,7 @@ namespace libtorrent {
// everything in LRU order (degrade to lru cache eviction) // everything in LRU order (degrade to lru cache eviction)
for (auto const& p : pieces) for (auto const& p : pieces)
{ {
cached_piece_entry* pe = m_disk_cache.find_piece(p.first, p.second); cached_piece_entry* pe = m_disk_cache.find_piece(p.first.get(), p.second);
if (pe == nullptr) continue; if (pe == nullptr) continue;
if (pe->num_dirty == 0) continue; if (pe->num_dirty == 0) continue;

View File

@ -4985,10 +4985,18 @@ namespace {
void session_impl::update_outgoing_interfaces() void session_impl::update_outgoing_interfaces()
{ {
std::string net_interfaces = m_settings.get_str(settings_pack::outgoing_interfaces); std::string const net_interfaces = m_settings.get_str(settings_pack::outgoing_interfaces);
// declared in string_util.hpp // declared in string_util.hpp
parse_comma_separated_string(net_interfaces, m_outgoing_interfaces); parse_comma_separated_string(net_interfaces, m_outgoing_interfaces);
#ifndef TORRENT_DISABLE_LOGGING
if (!net_interfaces.empty() && m_outgoing_interfaces.empty())
{
session_log("ERROR: failed to parse outgoing interface list: %s"
, net_interfaces.c_str());
}
#endif
} }
tcp::endpoint session_impl::bind_outgoing_socket(socket_type& s, address tcp::endpoint session_impl::bind_outgoing_socket(socket_type& s, address
@ -5229,6 +5237,11 @@ namespace {
#ifndef TORRENT_DISABLE_LOGGING #ifndef TORRENT_DISABLE_LOGGING
if (should_log()) if (should_log())
{ {
if (!net_interfaces.empty() && m_listen_interfaces.empty())
{
session_log("ERROR: failed to parse listen_interfaces setting: %s"
, net_interfaces.c_str());
}
session_log("update listen interfaces: %s", net_interfaces.c_str()); session_log("update listen interfaces: %s", net_interfaces.c_str());
session_log("parsed listen interfaces count: %d, ifaces: %s" session_log("parsed listen interfaces count: %d, ifaces: %s"
, int(m_listen_interfaces.size()) , int(m_listen_interfaces.size())
@ -5334,6 +5347,12 @@ namespace {
std::vector<std::pair<std::string, int>> nodes; std::vector<std::pair<std::string, int>> nodes;
parse_comma_separated_string_port(node_list, nodes); parse_comma_separated_string_port(node_list, nodes);
#ifndef TORRENT_DISABLE_LOGGING
if (!node_list.empty() && nodes.empty())
{
session_log("ERROR: failed to parse DHT bootstrap list: %s", node_list.c_str());
}
#endif
for (auto const& n : nodes) for (auto const& n : nodes)
add_dht_router(n); add_dht_router(n);
#endif #endif

View File

@ -837,6 +837,12 @@ namespace libtorrent {
std::shared_ptr<read_piece_struct> rp = std::make_shared<read_piece_struct>(); std::shared_ptr<read_piece_struct> rp = std::make_shared<read_piece_struct>();
rp->piece_data.reset(new (std::nothrow) char[piece_size]); rp->piece_data.reset(new (std::nothrow) char[piece_size]);
if (!rp->piece_data)
{
m_ses.alerts().emplace_alert<read_piece_alert>(
get_handle(), piece, error_code(boost::system::errc::not_enough_memory, generic_category()));
return;
}
rp->blocks_left = 0; rp->blocks_left = 0;
rp->fail = false; rp->fail = false;

View File

@ -57,6 +57,7 @@ deprecated_classes = os.popen('git grep TORRENT_DEPRECATED_EXPORT').read().split
def filter_classes(classes, keyword): def filter_classes(classes, keyword):
current_file = '' current_file = ''
ret = '' ret = ''
dht_ret = ''
for c in classes: for c in classes:
line = c.split(':', 1) line = c.split(':', 1)
if not line[0].endswith('.hpp'): continue if not line[0].endswith('.hpp'): continue
@ -71,13 +72,22 @@ def filter_classes(classes, keyword):
# TODO: support TORRENT_DEPRECATED_EXPORT # TODO: support TORRENT_DEPRECATED_EXPORT
if decl[1].strip() != keyword: continue if decl[1].strip() != keyword: continue
content = ''
if this_file != current_file: if this_file != current_file:
ret += '\n// ' + this_file + '\n' content += '\n// ' + this_file + '\n'
current_file = this_file; current_file = this_file;
decl = decl[0] + ' ' + decl[2] decl = decl[0] + ' ' + decl[2]
if not decl.endswith(';'): decl += ';' if not decl.endswith(';'): decl += ';'
ret += decl + '\n' content += decl + '\n'
return ret if 'kademlia' in this_file:
dht_ret += content
else:
ret += content
if dht_ret == '':
return ret
else:
return ret + '\nnamespace dht {\n' + dht_ret + '\n}\n'
os.remove('include/libtorrent/fwd.hpp') os.remove('include/libtorrent/fwd.hpp')
with open('include/libtorrent/fwd.hpp', 'w+') as f: with open('include/libtorrent/fwd.hpp', 'w+') as f: