fix where tracker connection did not bind to the correct network interface

This commit is contained in:
Arvid Norberg 2007-03-20 20:38:21 +00:00
parent 10da416c76
commit 41e26691fb
2 changed files with 5 additions and 1 deletions

View File

@ -530,6 +530,8 @@ namespace libtorrent
if (has_requester()) requester().m_tracker_address = target_address;
m_socket.reset(new stream_socket(m_name_lookup.io_service()));
m_socket->open(target_address.protocol());
m_socket->bind(tcp::endpoint(bind_interface(), 0));
m_socket->async_connect(target_address, bind(&http_tracker_connection::connected, self(), _1));
}
catch (std::exception& e)

View File

@ -92,7 +92,6 @@ namespace libtorrent
, m_settings(stn)
, m_attempts(0)
{
m_socket.reset(new datagram_socket(m_strand.io_service()));
udp::resolver::query q(hostname, boost::lexical_cast<std::string>(port));
m_name_lookup.async_resolve(q
, m_strand.wrap(boost::bind(
@ -144,6 +143,9 @@ namespace libtorrent
if (has_requester()) requester().m_tracker_address = tcp::endpoint(target_address.address(), target_address.port());
m_target = target_address;
m_socket.reset(new datagram_socket(m_name_lookup.io_service()));
m_socket->open(target_address.protocol());
m_socket->bind(udp::endpoint(bind_interface(), 0));
m_socket->connect(target_address);
send_udp_connect();
}