minor code refactor in ip_filter code

This commit is contained in:
Alden Torres 2018-05-14 11:01:43 -04:00 committed by Arvid Norberg
parent 17e9ce9dfd
commit a7b2026ef8
2 changed files with 3 additions and 12 deletions

View File

@ -125,7 +125,7 @@ namespace detail {
Addr tmp;
std::fill(tmp.begin(), tmp.end()
, (std::numeric_limits<typename Addr::value_type>::max)());
return Addr(tmp);
return tmp;
}
template<>
@ -288,7 +288,7 @@ struct TORRENT_EXPORT ip_filter
//
// This means that in a case of overlapping ranges, the last one applied takes
// precedence.
void add_rule(address first, address last, std::uint32_t flags);
void add_rule(address const& first, address const& last, std::uint32_t flags);
// Returns the access permissions for the given address (``addr``). The permission
// can currently be 0 or ``ip_filter::blocked``. The complexity of this operation

View File

@ -34,7 +34,7 @@ POSSIBILITY OF SUCH DAMAGE.
namespace libtorrent {
void ip_filter::add_rule(address first, address last, std::uint32_t flags)
void ip_filter::add_rule(address const& first, address const& last, std::uint32_t flags)
{
if (first.is_v4())
{
@ -83,13 +83,4 @@ namespace libtorrent {
{
return m_filter.access(port);
}
/*
void ip_filter::print() const
{
for (range_t::iterator i = m_access_list.begin(); i != m_access_list.end(); ++i)
{
std::cout << i->start.as_string() << " " << i->access << "\n";
}
}
*/
}