made the DHT socket bind to the same interface as the session

This commit is contained in:
Arvid Norberg 2010-03-02 07:21:32 +00:00
parent e8523a3ad4
commit 82b60b25c8
2 changed files with 7 additions and 3 deletions

View File

@ -109,6 +109,7 @@
* fast piece optimization
* added support for torrents with odd piece sizes
* fixed issue with disk read cache not being cleared when removing torrents
* made the DHT socket bind to the same interface as the session
release 0.14.9

View File

@ -3038,7 +3038,8 @@ namespace aux {
if (m_dht_same_port)
m_dht_settings.service_port = new_interface.port();
// the listen interface changed, rebind the dht listen socket as well
m_dht_socket.bind(m_dht_settings.service_port);
error_code ec;
m_dht_socket.bind(udp::endpoint(m_listen_interface.address(), m_dht_settings.service_port), ec);
maybe_update_udp_mapping(0, m_dht_settings.service_port, m_dht_settings.service_port);
maybe_update_udp_mapping(1, m_dht_settings.service_port, m_dht_settings.service_port);
@ -3258,7 +3259,8 @@ namespace aux {
m_dht = new dht::dht_tracker(*this, m_dht_socket, m_dht_settings, &startup_state);
if (!m_dht_socket.is_open() || m_dht_socket.local_port() != m_dht_settings.service_port)
{
m_dht_socket.bind(m_dht_settings.service_port);
error_code ec;
m_dht_socket.bind(udp::endpoint(m_listen_interface.address(), m_dht_settings.service_port), ec);
}
for (std::list<udp::endpoint>::iterator i = m_dht_router_nodes.begin()
@ -3336,7 +3338,8 @@ namespace aux {
&& settings.service_port != m_dht_settings.service_port
&& m_dht)
{
m_dht_socket.bind(settings.service_port);
error_code ec;
m_dht_socket.bind(udp::endpoint(m_listen_interface.address(), settings.service_port), ec);
maybe_update_udp_mapping(0, settings.service_port, settings.service_port);
maybe_update_udp_mapping(1, settings.service_port, settings.service_port);