merged RC_1_1 into master

This commit is contained in:
arvidn 2016-07-20 11:34:29 -07:00
commit e405f0e02f
7 changed files with 24 additions and 10 deletions

View File

@ -26,6 +26,7 @@
1.1.1 release
* fix crash in session::get_ip_filter when not having set one
* fix filename escaping when repairing torrents with broken web seeds
* fix bug where file_completed_alert would not be posted unless file_progress
had been queries by the client

View File

@ -72,7 +72,6 @@ protected:
data_callback m_data_callback;
item m_data;
std::string m_salt;
bool m_immutable;
};

View File

@ -300,6 +300,12 @@ namespace libtorrent
disconnect_if_redundant();
if (m_disconnecting) return;
if (!m_sent_handshake) return;
// we're still waiting to fully handshake with this peer. At the end of
// the handshake we'll send the bitfield and dht port anyway. It's too
// early to do now
if (m_state < read_packet_size) return;
// connections that are still in the handshake
// will send their bitfield when the handshake
// is done
@ -307,13 +313,6 @@ namespace libtorrent
write_upload_only();
#endif
if (!m_sent_handshake) return;
// we're still waiting to fully handshake with this peer. At the end of
// the handshake we'll send the bitfield and dht port anyway. It's too
// early to do now
if (m_state < read_peer_id) return;
if (m_sent_bitfield) return;
boost::shared_ptr<torrent> t = associated_torrent().lock();

View File

@ -78,7 +78,8 @@ void get_item::got_data(bdecode_node const& v,
// data can reach here, which means pk and sig must be valid.
if (!pk || !sig) return;
std::pair<char const*, int> salt(m_salt.c_str(), int(m_salt.size()));
std::string temp_copy(m_data.salt());
std::pair<char const*, int> salt(temp_copy.c_str(), int(temp_copy.size()));
sha1_hash incoming_target = item_target_id(salt, pk);
if (incoming_target != m_target) return;

View File

@ -91,7 +91,7 @@ lsd::lsd(io_service& ios, peer_callback_t const& cb
, m_log_cb(log)
#endif
, m_broadcast_timer(ios)
, m_cookie(random())
, m_cookie(random() & 0x7fffffff)
, m_disabled(false)
#if TORRENT_USE_IPV6
, m_disabled6(false)

View File

@ -1018,6 +1018,7 @@ namespace aux {
ip_filter const& session_impl::get_ip_filter()
{
TORRENT_ASSERT(is_single_thread());
if (!m_ip_filter) m_ip_filter = boost::make_shared<ip_filter>();
return *m_ip_filter;
}

View File

@ -36,6 +36,7 @@ POSSIBILITY OF SUCH DAMAGE.
#include "test.hpp"
#include "libtorrent/socket_io.hpp"
#include "libtorrent/session.hpp"
/*
@ -86,6 +87,18 @@ void test_rules_invariant(std::vector<ip_range<T> > const& r, ip_filter const& f
}
}
TORRENT_TEST(session_get_ip_filter)
{
using namespace libtorrent;
session ses;
ip_filter const& ipf = ses.get_ip_filter();
#if TORRENT_USE_IPV6
TEST_EQUAL(boost::get<0>(ipf.export_filter()).size(), 1);
#else
TEST_EQUAL(ipf.export_filter().size(), 1);
#endif
}
TORRENT_TEST(ip_filter)
{
using namespace libtorrent;