diff --git a/src/http_connection.cpp b/src/http_connection.cpp index 46cb53324..ed1b98e56 100644 --- a/src/http_connection.cpp +++ b/src/http_connection.cpp @@ -882,6 +882,8 @@ void http_connection::on_assign_bandwidth(error_code const& e) m_limiter_timer_active = false; if (e) return; + if (m_abort) return; + if (m_download_quota > 0) return; m_download_quota = m_rate_limit / 4; diff --git a/src/upnp.cpp b/src/upnp.cpp index 75657190e..be52ab795 100644 --- a/src/upnp.cpp +++ b/src/upnp.cpp @@ -955,6 +955,8 @@ void upnp::on_upnp_xml(error_code const& e d.upnp_connection.reset(); } + if (m_closing) return; + if (e && e != boost::asio::error::eof) { #ifndef TORRENT_DISABLE_LOGGING @@ -1059,6 +1061,7 @@ void upnp::on_upnp_xml(error_code const& e return; } + if (d.upnp_connection) d.upnp_connection->close(); d.upnp_connection = std::make_shared(m_io_service , m_resolver , std::bind(&upnp::on_upnp_get_ip_address_response, self(), _1, _2 @@ -1566,6 +1569,8 @@ void upnp::on_expire(error_code const& ec) COMPLETE_ASYNC("upnp::on_expire"); if (ec) return; + if (m_closing) return; + time_point const now = aux::time_now(); time_point next_expire = max_time();