Skip to content

Commit

Permalink
fix crash in session::get_ip_filter when not having set one
Browse files Browse the repository at this point in the history
  • Loading branch information
arvidn committed Jul 17, 2016
1 parent c0d7650 commit 66e5994
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 0 deletions.
1 change: 1 addition & 0 deletions ChangeLog
@@ -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
Expand Down
1 change: 1 addition & 0 deletions src/session_impl.cpp
Expand Up @@ -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;
}

Expand Down
13 changes: 13 additions & 0 deletions test/test_ip_filter.cpp
Expand Up @@ -35,6 +35,7 @@ POSSIBILITY OF SUCH DAMAGE.

#include "test.hpp"
#include "libtorrent/socket_io.hpp"
#include "libtorrent/session.hpp"

/*
Expand Down Expand Up @@ -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;
Expand Down

0 comments on commit 66e5994

Please sign in to comment.