diff --git a/src/upnp.cpp b/src/upnp.cpp index 1ae8dee2f..0e38485a0 100644 --- a/src/upnp.cpp +++ b/src/upnp.cpp @@ -825,11 +825,15 @@ void upnp::on_expire(asio::error_code const& e) void upnp::close() { - if (m_disabled) return; - m_socket.close(); - boost::mutex::scoped_lock l(m_mutex); m_closing = true; + m_socket.close(); + + if (m_disabled) + { + m_devices.clear(); + return; + } for (std::set::iterator i = m_devices.begin() , end(m_devices.end()); i != end;)