more lint oriented code refactor/cleanup
This commit is contained in:
parent
ab56bf964f
commit
2c5da2778a
|
@ -176,7 +176,7 @@ TORRENT_VERSION_NAMESPACE_2
|
||||||
{
|
{
|
||||||
// the tracker was part of the .torrent file
|
// the tracker was part of the .torrent file
|
||||||
source_torrent = 1,
|
source_torrent = 1,
|
||||||
// the tracker was added programatically via the add_tracker() function
|
// the tracker was added programmatically via the add_tracker() function
|
||||||
source_client = 2,
|
source_client = 2,
|
||||||
// the tracker was part of a magnet link
|
// the tracker was part of a magnet link
|
||||||
source_magnet_link = 4,
|
source_magnet_link = 4,
|
||||||
|
|
|
@ -45,13 +45,14 @@ namespace libtorrent { namespace aux {
|
||||||
{
|
{
|
||||||
friend struct session_impl;
|
friend struct session_impl;
|
||||||
|
|
||||||
listen_socket_handle() {}
|
listen_socket_handle() = default;
|
||||||
|
|
||||||
listen_socket_handle(std::shared_ptr<listen_socket_t> s) // NOLINT
|
listen_socket_handle(std::shared_ptr<listen_socket_t> s) // NOLINT
|
||||||
: m_sock(s)
|
: m_sock(s)
|
||||||
{}
|
{}
|
||||||
|
|
||||||
listen_socket_handle(listen_socket_handle const& o) = default;
|
listen_socket_handle(listen_socket_handle const& o) = default;
|
||||||
|
listen_socket_handle& operator=(listen_socket_handle const& o) = default;
|
||||||
|
|
||||||
explicit operator bool() const { return !m_sock.expired(); }
|
explicit operator bool() const { return !m_sock.expired(); }
|
||||||
|
|
||||||
|
@ -73,12 +74,6 @@ namespace libtorrent { namespace aux {
|
||||||
bool operator<(listen_socket_handle const& o) const
|
bool operator<(listen_socket_handle const& o) const
|
||||||
{ return m_sock.owner_before(o.m_sock); }
|
{ return m_sock.owner_before(o.m_sock); }
|
||||||
|
|
||||||
listen_socket_handle& operator=(listen_socket_handle const& o)
|
|
||||||
{
|
|
||||||
m_sock = o.m_sock;
|
|
||||||
return *this;
|
|
||||||
}
|
|
||||||
|
|
||||||
listen_socket_t* get() const;
|
listen_socket_t* get() const;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
|
|
@ -297,9 +297,10 @@ namespace aux {
|
||||||
return reinterpret_cast<S const*>(&m_data);
|
return reinterpret_cast<S const*>(&m_data);
|
||||||
}
|
}
|
||||||
|
|
||||||
private:
|
|
||||||
// explicitly disallow assignment, to silence msvc warning
|
// explicitly disallow assignment, to silence msvc warning
|
||||||
socket_type& operator=(socket_type const&);
|
socket_type& operator=(socket_type const&) = delete;
|
||||||
|
|
||||||
|
private:
|
||||||
|
|
||||||
void destruct();
|
void destruct();
|
||||||
void construct(int type, void* userdata);
|
void construct(int type, void* userdata);
|
||||||
|
|
|
@ -429,4 +429,3 @@ namespace aux {
|
||||||
|
|
||||||
} // aux
|
} // aux
|
||||||
} // libtorrent
|
} // libtorrent
|
||||||
|
|
||||||
|
|
|
@ -65,7 +65,6 @@ namespace libtorrent {
|
||||||
if (m_external_addresses.empty()) return false;
|
if (m_external_addresses.empty()) return false;
|
||||||
|
|
||||||
// if there's just one vote, go with that
|
// if there's just one vote, go with that
|
||||||
std::vector<external_ip_t>::iterator i;
|
|
||||||
if (m_external_addresses.size() == 1)
|
if (m_external_addresses.size() == 1)
|
||||||
{
|
{
|
||||||
// avoid flapping. We need more votes to change our mind on the
|
// avoid flapping. We need more votes to change our mind on the
|
||||||
|
@ -84,7 +83,7 @@ namespace libtorrent {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
i = m_external_addresses.begin();
|
auto const i = m_external_addresses.begin();
|
||||||
|
|
||||||
bool ret = m_external_address != i->addr;
|
bool ret = m_external_address != i->addr;
|
||||||
m_external_address = i->addr;
|
m_external_address = i->addr;
|
||||||
|
|
|
@ -1015,7 +1015,7 @@ namespace aux {
|
||||||
|
|
||||||
peer_class_info session_impl::get_peer_class(peer_class_t const cid) const
|
peer_class_info session_impl::get_peer_class(peer_class_t const cid) const
|
||||||
{
|
{
|
||||||
peer_class_info ret;
|
peer_class_info ret{};
|
||||||
peer_class const* pc = m_classes.at(cid);
|
peer_class const* pc = m_classes.at(cid);
|
||||||
// if you hit this assert, you're passing in an invalid cid
|
// if you hit this assert, you're passing in an invalid cid
|
||||||
TORRENT_ASSERT_PRECOND(pc);
|
TORRENT_ASSERT_PRECOND(pc);
|
||||||
|
@ -6785,8 +6785,7 @@ namespace aux {
|
||||||
auto i = iface.m_sock.lock();
|
auto i = iface.m_sock.lock();
|
||||||
TORRENT_ASSERT(i);
|
TORRENT_ASSERT(i);
|
||||||
if (!i) return;
|
if (!i) return;
|
||||||
set_external_address(std::static_pointer_cast<listen_socket_t>(i), ip
|
set_external_address(i, ip, source_dht, source);
|
||||||
, source_dht, source);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void session_impl::get_peers(sha1_hash const& ih)
|
void session_impl::get_peers(sha1_hash const& ih)
|
||||||
|
|
Loading…
Reference in New Issue