fix crash in session::get_ip_filter when not having set one (#914)

This commit is contained in:
Arvid Norberg 2016-07-17 14:23:54 -07:00 committed by GitHub
parent c0d7650926
commit 80fba1f748
3 changed files with 15 additions and 0 deletions

View File

@ -1,5 +1,6 @@
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

@ -1239,6 +1239,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

@ -35,6 +35,7 @@ POSSIBILITY OF SUCH DAMAGE.
#include "test.hpp"
#include "libtorrent/socket_io.hpp"
#include "libtorrent/session.hpp"
/*
@ -89,6 +90,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;