forked from premiere/premiere-libtorrent
fix handling of SSL listen sockets
This commit is contained in:
parent
d48c835f65
commit
2e79c5e648
|
@ -198,6 +198,9 @@ namespace aux {
|
|||
tcp::endpoint get_local_endpoint() override
|
||||
{ return local_endpoint; }
|
||||
|
||||
bool is_ssl() override
|
||||
{ return ssl == transport::ssl; }
|
||||
|
||||
listen_socket_t(listen_socket_impl const& i) // NOLINT
|
||||
: listen_socket_impl(i)
|
||||
{}
|
||||
|
|
|
@ -47,6 +47,8 @@ namespace libtorrent { namespace aux {
|
|||
virtual address get_external_address() = 0;
|
||||
virtual tcp::endpoint get_local_endpoint() = 0;
|
||||
|
||||
virtual bool is_ssl() = 0;
|
||||
|
||||
session_listen_socket() = default;
|
||||
|
||||
protected:
|
||||
|
|
|
@ -169,6 +169,8 @@ struct dht_node final : lt::dht::socket_manager, lt::aux::session_listen_socket
|
|||
return tcp::endpoint(address_v4(), 0);
|
||||
}
|
||||
|
||||
bool is_ssl() override { return false; }
|
||||
|
||||
// the node_id and IP address of this node
|
||||
std::pair<dht::node_id, lt::udp::endpoint> node_info() const
|
||||
{
|
||||
|
|
|
@ -95,6 +95,8 @@ struct mock_socket : lt::aux::session_listen_socket
|
|||
{
|
||||
return tcp::endpoint(address_v4::from_string("40.30.20.10"), 8888);
|
||||
}
|
||||
|
||||
bool is_ssl() override { return false; }
|
||||
};
|
||||
|
||||
void send_packet(lt::udp_socket& sock, lt::aux::session_listen_socket*, udp::endpoint const& ep
|
||||
|
|
|
@ -116,6 +116,8 @@ namespace libtorrent { namespace dht {
|
|||
|
||||
void dht_tracker::new_socket(aux::session_listen_socket* s)
|
||||
{
|
||||
if (s->is_ssl()) return;
|
||||
|
||||
address local_address = s->get_local_endpoint().address();
|
||||
#if TORRENT_USE_IPV6
|
||||
// don't try to start dht nodes on non-global IPv6 addresses
|
||||
|
@ -156,6 +158,8 @@ namespace libtorrent { namespace dht {
|
|||
|
||||
void dht_tracker::delete_socket(aux::session_listen_socket* s)
|
||||
{
|
||||
if (s->is_ssl()) return;
|
||||
|
||||
#if TORRENT_USE_IPV6
|
||||
address local_address = s->get_local_endpoint().address();
|
||||
// since we don't start nodes on local IPv6 interfaces we don't need to remove them either
|
||||
|
|
|
@ -2700,6 +2700,8 @@ namespace libtorrent {
|
|||
// and removing entries for non-existent ones
|
||||
std::vector<announce_endpoint>::size_type valid_endpoints = 0;
|
||||
m_ses.for_each_listen_socket([&](aux::session_listen_socket* s) {
|
||||
if (s->is_ssl() != is_ssl_torrent())
|
||||
return;
|
||||
for (auto& aep : ae.endpoints)
|
||||
{
|
||||
if (aep.socket != s) continue;
|
||||
|
|
|
@ -131,6 +131,8 @@ struct mock_dht_socket final : aux::session_listen_socket
|
|||
address get_external_address() override { return m_external_address; }
|
||||
tcp::endpoint get_local_endpoint() override { return m_local_endpoint; }
|
||||
|
||||
bool is_ssl() override { return false; }
|
||||
|
||||
address m_external_address;
|
||||
tcp::endpoint m_local_endpoint;
|
||||
};
|
||||
|
@ -141,6 +143,8 @@ struct mock_dht_socket6 final : aux::session_listen_socket
|
|||
address get_external_address() override { return m_external_address; }
|
||||
tcp::endpoint get_local_endpoint() override { return m_local_endpoint; }
|
||||
|
||||
bool is_ssl() override { return false; }
|
||||
|
||||
address m_external_address = addr6("2002::1");
|
||||
tcp::endpoint m_local_endpoint = tcp::endpoint(addr6("2002::1"), 6881);
|
||||
};
|
||||
|
|
Loading…
Reference in New Issue