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

View File

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