forked from premiere/premiere-libtorrent
fixed deadlock in some session member functions
This commit is contained in:
parent
3c18f164ab
commit
f20f63f865
|
@ -515,8 +515,8 @@ namespace libtorrent
|
|||
p.userdata = userdata;
|
||||
return add_torrent(p);
|
||||
}
|
||||
#endif
|
||||
#endif
|
||||
#endif // TORRENT_NO_DEPRECATE
|
||||
#endif // BOOST_NO_EXCEPTIONS
|
||||
|
||||
void session::remove_torrent(const torrent_handle& h, int options)
|
||||
{
|
||||
|
@ -736,11 +736,13 @@ namespace libtorrent
|
|||
|
||||
int session::local_upload_rate_limit() const
|
||||
{
|
||||
session_impl::mutex_t::scoped_lock l(m_impl->m_mutex);
|
||||
return m_impl->local_upload_rate_limit();
|
||||
}
|
||||
|
||||
int session::local_download_rate_limit() const
|
||||
{
|
||||
session_impl::mutex_t::scoped_lock l(m_impl->m_mutex);
|
||||
return m_impl->local_download_rate_limit();
|
||||
}
|
||||
|
||||
|
@ -758,11 +760,13 @@ namespace libtorrent
|
|||
|
||||
void session::set_local_upload_rate_limit(int bytes_per_second)
|
||||
{
|
||||
session_impl::mutex_t::scoped_lock l(m_impl->m_mutex);
|
||||
m_impl->set_local_upload_rate_limit(bytes_per_second);
|
||||
}
|
||||
|
||||
void session::set_local_download_rate_limit(int bytes_per_second)
|
||||
{
|
||||
session_impl::mutex_t::scoped_lock l(m_impl->m_mutex);
|
||||
m_impl->set_local_download_rate_limit(bytes_per_second);
|
||||
}
|
||||
|
||||
|
@ -798,11 +802,13 @@ namespace libtorrent
|
|||
|
||||
void session::set_alert_dispatch(boost::function<void(alert const&)> const& fun)
|
||||
{
|
||||
// this function deliberately doesn't acquire the mutex
|
||||
return m_impl->set_alert_dispatch(fun);
|
||||
}
|
||||
|
||||
alert const* session::wait_for_alert(time_duration max_wait)
|
||||
{
|
||||
// this function deliberately doesn't acquire the mutex
|
||||
return m_impl->wait_for_alert(max_wait);
|
||||
}
|
||||
|
||||
|
|
|
@ -2683,8 +2683,6 @@ namespace aux {
|
|||
|
||||
void session_impl::set_local_download_rate_limit(int bytes_per_second)
|
||||
{
|
||||
mutex_t::scoped_lock l(m_mutex);
|
||||
|
||||
INVARIANT_CHECK;
|
||||
|
||||
if (bytes_per_second <= 0) bytes_per_second = 0;
|
||||
|
@ -2693,8 +2691,6 @@ namespace aux {
|
|||
|
||||
void session_impl::set_local_upload_rate_limit(int bytes_per_second)
|
||||
{
|
||||
mutex_t::scoped_lock l(m_mutex);
|
||||
|
||||
INVARIANT_CHECK;
|
||||
|
||||
if (bytes_per_second <= 0) bytes_per_second = 0;
|
||||
|
@ -2749,19 +2745,16 @@ namespace aux {
|
|||
|
||||
int session_impl::local_upload_rate_limit() const
|
||||
{
|
||||
mutex_t::scoped_lock l(m_mutex);
|
||||
return m_local_upload_channel.throttle();
|
||||
}
|
||||
|
||||
int session_impl::local_download_rate_limit() const
|
||||
{
|
||||
mutex_t::scoped_lock l(m_mutex);
|
||||
return m_local_download_channel.throttle();
|
||||
}
|
||||
|
||||
int session_impl::upload_rate_limit() const
|
||||
{
|
||||
mutex_t::scoped_lock l(m_mutex);
|
||||
return m_upload_channel.throttle();
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue