forked from pool/libtorrent-rasterbar
32 lines
747 B
Diff
32 lines
747 B
Diff
--- a/src/session_impl.cpp
|
|
+++ b/src/session_impl.cpp
|
|
@@ -1237,6 +1237,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;
|
|
}
|
|
|
|
--- a/test/test_ip_filter.cpp
|
|
+++ b/test/test_ip_filter.cpp
|
|
@@ -89,6 +89,18 @@ void test_rules_invariant(std::vector<ip
|
|
}
|
|
}
|
|
|
|
+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;
|