added resolver cancellation to http_connection and udp_socket. might prevent potential shutdown stalls

This commit is contained in:
Arvid Norberg 2008-12-20 18:27:09 +00:00
parent 41b2be779e
commit 4bd0d2d2e6
3 changed files with 8 additions and 0 deletions

View File

@ -250,6 +250,7 @@ void http_connection::close()
{
error_code ec;
m_timer.cancel(ec);
m_resolver.cancel();
m_limiter_timer.cancel(ec);
m_sock.close(ec);
m_hostname.clear();

View File

@ -2538,6 +2538,8 @@ namespace libtorrent
(*m_ses.m_logger) << time_now_string() << " completed resolve proxy hostname for: " << url << "\n";
#endif
if (m_abort) return;
if (e || host == tcp::resolver::iterator())
{
if (m_ses.m_alerts.should_post<url_seed_alert>())
@ -2597,6 +2599,8 @@ namespace libtorrent
(*m_ses.m_logger) << time_now_string() << " completed resolve: " << url << "\n";
#endif
if (m_abort) return;
std::set<std::string>::iterator i = m_resolving_web_seeds.find(url);
if (i != m_resolving_web_seeds.end()) m_resolving_web_seeds.erase(i);
@ -2740,6 +2744,8 @@ namespace libtorrent
m_resolving_country = false;
if (m_abort) return;
// must be ordered in increasing order
static const country_entry country_map[] =
{

View File

@ -251,6 +251,7 @@ void udp_socket::close()
m_ipv4_sock.close(ec);
m_ipv6_sock.close(ec);
m_socks5_sock.close(ec);
m_resolver.cancel();
if (m_connection_ticket >= 0)
{
m_cc.done(m_connection_ticket);