merged RC_1_1 into master
This commit is contained in:
commit
33414de68d
|
@ -32,6 +32,9 @@
|
|||
* resume data no longer has timestamps of files
|
||||
* require C++11 to build libtorrent
|
||||
|
||||
* fix internal resolve links lookup for mutable torrents
|
||||
* hint DHT bootstrap nodes of actual bootstrap request
|
||||
|
||||
1.1.1 release
|
||||
|
||||
* update puff.c for gzip inflation
|
||||
|
|
|
@ -1,9 +1,9 @@
|
|||
#!/bin/sh
|
||||
|
||||
make distclean
|
||||
make clean
|
||||
|
||||
cd docs
|
||||
make
|
||||
make RST2HTML=rst2html-3.4.py
|
||||
cd ..
|
||||
|
||||
#clear out any extended attributes that Finder may add
|
||||
|
@ -23,7 +23,7 @@ chmod a-x docs/*.rst docs/*.htm* src/*.cpp include/libtorrent/*.hpp
|
|||
|
||||
./autotool.sh
|
||||
./configure --enable-python-binding --enable-examples=yes --enable-encryption --enable-tests=yes --with-boost-system=mt --with-boost-python=mt
|
||||
make V=1 -j8 distcheck
|
||||
make V=1 -j8 check
|
||||
|
||||
./configure --enable-python-binding --enable-examples=yes --enable-encryption --with-boost-system=mt --with-boost-python=mt
|
||||
make V=1 -j8 dist
|
||||
|
|
|
@ -14,7 +14,7 @@ bin_PROGRAMS = $(example_programs)
|
|||
endif
|
||||
|
||||
EXTRA_PROGRAMS = $(example_programs)
|
||||
EXTRA_DIST = Jamfile CMakeLists.txt run_cmake.sh.in cmake/FindLibtorrentRasterbar.cmake
|
||||
EXTRA_DIST = Jamfile CMakeLists.txt run_cmake.sh.in session_view.hpp torrent_view.hpp print.hpp cmake/FindLibtorrentRasterbar.cmake
|
||||
|
||||
client_test_SOURCES = client_test.cpp print.cpp session_view.cpp torrent_view.cpp
|
||||
stats_counters_SOURCES = stats_counters.cpp
|
||||
|
|
|
@ -141,6 +141,7 @@ int main(int argc, char const* argv[])
|
|||
// save resume data once every 30 seconds
|
||||
if (clk::now() - last_save_resume > std::chrono::seconds(30)) {
|
||||
h.save_resume_data();
|
||||
last_save_resume = clk::now();
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -70,7 +70,7 @@ bool TORRENT_EXTRA_EXPORT verify_secret_id(node_id const& nid);
|
|||
node_id TORRENT_EXTRA_EXPORT generate_id_impl(address const& ip_, std::uint32_t r);
|
||||
|
||||
bool TORRENT_EXTRA_EXPORT verify_id(node_id const& nid, address const& source_ip);
|
||||
bool TORRENT_EXTRA_EXPORT matching_prefix(node_entry const& n, int mask, int prefix, int bucket_index);
|
||||
bool TORRENT_EXTRA_EXPORT matching_prefix(node_entry const& n, int mask, int prefix, int offset);
|
||||
node_id TORRENT_EXTRA_EXPORT generate_prefix_mask(int bits);
|
||||
|
||||
} } // namespace libtorrent::dht
|
||||
|
|
|
@ -306,10 +306,12 @@ struct fake_node
|
|||
|
||||
lt::bdecode_node n;
|
||||
boost::system::error_code err;
|
||||
int const ret = bdecode(m_in_buffer, m_in_buffer + bytes_transferred
|
||||
int const ret = bdecode(m_in_buffer.data(), m_in_buffer.data() + bytes_transferred
|
||||
, n, err, nullptr, 10, 200);
|
||||
TEST_EQUAL(ret, 0);
|
||||
|
||||
m_incoming_packets.emplace_back(m_in_buffer.data(), m_in_buffer.data() + bytes_transferred);
|
||||
|
||||
// TODO: ideally we would validate the DHT message
|
||||
m_tripped = true;
|
||||
});
|
||||
|
@ -322,9 +324,14 @@ struct fake_node
|
|||
|
||||
bool tripped() const { return m_tripped; }
|
||||
|
||||
std::vector<std::vector<char>> const& incoming_packets() const
|
||||
{ return m_incoming_packets; }
|
||||
|
||||
private:
|
||||
|
||||
char m_in_buffer[300];
|
||||
std::array<char, 300> m_in_buffer;
|
||||
|
||||
std::vector<std::vector<char>> m_incoming_packets;
|
||||
|
||||
asio::io_service m_ios;
|
||||
asio::ip::udp::socket m_socket;
|
||||
|
|
|
@ -93,5 +93,15 @@ TORRENT_TEST(dht_bootstrap)
|
|||
sim.run();
|
||||
|
||||
TEST_EQUAL(node.tripped(), true);
|
||||
|
||||
std::vector<char> const& p = node.incoming_packets().front();
|
||||
lt::bdecode_node n;
|
||||
boost::system::error_code err;
|
||||
int const ret = bdecode(p.data(), p.data() + p.size()
|
||||
, n, err, nullptr, 10, 200);
|
||||
TEST_EQUAL(ret, 0);
|
||||
|
||||
lt::bdecode_node a = n.dict_find_dict("a");
|
||||
TEST_CHECK(a.dict_find_int_value("bs", -1) == 1);
|
||||
}
|
||||
|
||||
|
|
|
@ -198,10 +198,10 @@ node_id generate_id(address const& ip)
|
|||
return generate_id_impl(ip, random(0xffffffff));
|
||||
}
|
||||
|
||||
bool matching_prefix(node_entry const& n, int mask, int prefix, int bucket_index)
|
||||
bool matching_prefix(node_entry const& n, int mask, int prefix, int offset)
|
||||
{
|
||||
node_id id = n.id;
|
||||
id <<= bucket_index + 1;
|
||||
id <<= offset;
|
||||
return (id[0] & mask) == prefix;
|
||||
}
|
||||
|
||||
|
|
|
@ -65,6 +65,14 @@ bool bootstrap::invoke(observer_ptr o)
|
|||
make_id_secret(target);
|
||||
a["info_hash"] = target.to_string();
|
||||
|
||||
if (o->flags & observer::flag_initial)
|
||||
{
|
||||
// if this packet is being sent to a bootstrap/router node, let it know
|
||||
// that we're actualy bootstrapping (as opposed to being collateral
|
||||
// traffic).
|
||||
a["bs"] = 1;
|
||||
}
|
||||
|
||||
// e["q"] = "find_node";
|
||||
// a["target"] = target.to_string();
|
||||
m_node.stats_counters().inc_stats_counter(counters::dht_get_peers_out);
|
||||
|
|
|
@ -909,18 +909,19 @@ ip_ok:
|
|||
std::vector<bucket_t::iterator> nodes;
|
||||
bool force_replace = false;
|
||||
|
||||
// the last bucket is special, since it hasn't been split yet, it
|
||||
// includes that top bit as well
|
||||
int const prefix_offset =
|
||||
bucket_index + 1 == m_buckets.size() ? bucket_index : bucket_index + 1;
|
||||
|
||||
{
|
||||
node_id id = e.id;
|
||||
// the last bucket is special, since it hasn't been split yet, it
|
||||
// includes that top bit as well
|
||||
if (bucket_index + 1 == m_buckets.size())
|
||||
id <<= bucket_index;
|
||||
else
|
||||
id <<= bucket_index + 1;
|
||||
id <<= prefix_offset;
|
||||
int const candidate_prefix = id[0] & mask;
|
||||
|
||||
for (j = b.begin(); j != b.end(); ++j)
|
||||
{
|
||||
if (!matching_prefix(*j, mask, id[0] & mask, bucket_index)) continue;
|
||||
if (!matching_prefix(*j, mask, candidate_prefix, prefix_offset)) continue;
|
||||
nodes.push_back(j);
|
||||
}
|
||||
}
|
||||
|
@ -950,7 +951,7 @@ ip_ok:
|
|||
for (j = b.begin(); j != b.end(); ++j)
|
||||
{
|
||||
node_id id = j->id;
|
||||
id <<= bucket_index + 1;
|
||||
id <<= prefix_offset;
|
||||
int this_prefix = (id[0] & mask) >> mask_shift;
|
||||
TORRENT_ASSERT(this_prefix >= 0);
|
||||
TORRENT_ASSERT(this_prefix < int(prefix.size()));
|
||||
|
|
|
@ -65,7 +65,7 @@ void resolve_links::match(std::shared_ptr<const torrent_info> const& ti
|
|||
{
|
||||
if (!ti) return;
|
||||
|
||||
// only torrents with the same
|
||||
// only torrents with the same piece size
|
||||
if (ti->piece_length() != m_torrent_file->piece_length()) return;
|
||||
|
||||
int piece_size = ti->piece_length();
|
||||
|
@ -82,7 +82,7 @@ void resolve_links::match(std::shared_ptr<const torrent_info> const& ti
|
|||
if ((fs.file_offset(i) % piece_size) != 0) continue;
|
||||
if (fs.pad_file_at(i)) continue;
|
||||
|
||||
std::int64_t file_size = fs.file_size(i);
|
||||
std::int64_t const file_size = fs.file_size(i);
|
||||
|
||||
auto range = m_file_sizes.equal_range(file_size);
|
||||
for (auto iter = range.first; iter != range.second; ++iter)
|
||||
|
|
|
@ -589,8 +589,12 @@ namespace libtorrent
|
|||
if (index < 0 || index >= settings_pack::num_string_settings)
|
||||
continue;
|
||||
|
||||
// if the vaue did not change, don't call the update callback
|
||||
if (sett.get_str(p.first) == p.second) continue;
|
||||
|
||||
sett.set_str(p.first, p.second);
|
||||
str_setting_entry_t const& sa = str_settings[index];
|
||||
|
||||
if (sa.fun && ses
|
||||
&& std::find(callbacks.begin(), callbacks.end(), sa.fun) == callbacks.end())
|
||||
callbacks.push_back(sa.fun);
|
||||
|
@ -608,6 +612,9 @@ namespace libtorrent
|
|||
if (index < 0 || index >= settings_pack::num_int_settings)
|
||||
continue;
|
||||
|
||||
// if the vaue did not change, don't call the update callback
|
||||
if (sett.get_int(p.first) == p.second) continue;
|
||||
|
||||
sett.set_int(p.first, p.second);
|
||||
int_setting_entry_t const& sa = int_settings[index];
|
||||
if (sa.fun && ses
|
||||
|
@ -627,6 +634,9 @@ namespace libtorrent
|
|||
if (index < 0 || index >= settings_pack::num_bool_settings)
|
||||
continue;
|
||||
|
||||
// if the vaue did not change, don't call the update callback
|
||||
if (sett.get_bool(p.first) == p.second) continue;
|
||||
|
||||
sett.set_bool(p.first, p.second);
|
||||
bool_setting_entry_t const& sa = bool_settings[index];
|
||||
if (sa.fun && ses
|
||||
|
|
Loading…
Reference in New Issue