fixed deadlock in natpmp implementation

This commit is contained in:
Arvid Norberg 2009-09-22 04:01:01 +00:00
parent a1c37d4796
commit 6de02f9895
3 changed files with 11 additions and 1 deletions

View File

@ -72,6 +72,10 @@
* improved support for sparse files on windows
* added ability to give seeding torrents preference to active slots
release 0.14.7
* fixed deadlock in natpmp
release 0.14.6
* various missing include fixes to be buildable with boost 1.40

View File

@ -80,6 +80,7 @@ private:
void try_next_mapping(int i, mutex_t::scoped_lock& l);
void update_expiration_timer();
void mapping_expired(error_code const& e, int i);
void close_impl(mutex_t::scoped_lock& l);
void log(char const* msg, mutex_t::scoped_lock& l);
void disable(error_code const& ec, mutex_t::scoped_lock& l);

View File

@ -154,7 +154,7 @@ void natpmp::disable(error_code const& ec, mutex_t::scoped_lock& l)
m_callback(index, 0, ec);
l.lock();
}
close();
close_impl(l);
}
void natpmp::delete_mapping(int index)
@ -550,6 +550,11 @@ void natpmp::mapping_expired(error_code const& e, int i)
void natpmp::close()
{
mutex_t::scoped_lock l(m_mutex);
close_impl(l);
}
void natpmp::close_impl(mutex_t::scoped_lock& l)
{
m_abort = true;
log("closing", l);
/*