got rid of the last recursive mutexes. abstracted the threading primitives (and switched over to use asio's internal ones).
This commit is contained in:
@@ -117,7 +117,7 @@ void udp_socket::send(udp::endpoint const& ep, char const* p, int len, error_cod
|
||||
void udp_socket::on_read(udp::socket* s, error_code const& e, std::size_t bytes_transferred)
|
||||
{
|
||||
TORRENT_ASSERT(m_magic == 0x1337);
|
||||
mutex_t::scoped_lock l(m_mutex);
|
||||
mutex::scoped_lock l(m_mutex);
|
||||
|
||||
TORRENT_ASSERT(m_outstanding > 0);
|
||||
--m_outstanding;
|
||||
@@ -332,7 +332,7 @@ void udp_socket::unwrap(error_code const& e, char const* buf, int size)
|
||||
|
||||
void udp_socket::close()
|
||||
{
|
||||
mutex_t::scoped_lock l(m_mutex);
|
||||
mutex::scoped_lock l(m_mutex);
|
||||
TORRENT_ASSERT(m_magic == 0x1337);
|
||||
|
||||
error_code ec;
|
||||
@@ -361,7 +361,7 @@ void udp_socket::close()
|
||||
void udp_socket::bind(udp::endpoint const& ep, error_code& ec)
|
||||
{
|
||||
CHECK_MAGIC;
|
||||
mutex_t::scoped_lock l(m_mutex);
|
||||
mutex::scoped_lock l(m_mutex);
|
||||
|
||||
if (m_ipv4_sock.is_open()) m_ipv4_sock.close(ec);
|
||||
#if TORRENT_USE_IPV6
|
||||
@@ -398,7 +398,7 @@ void udp_socket::bind(udp::endpoint const& ep, error_code& ec)
|
||||
void udp_socket::bind(int port)
|
||||
{
|
||||
CHECK_MAGIC;
|
||||
mutex_t::scoped_lock l(m_mutex);
|
||||
mutex::scoped_lock l(m_mutex);
|
||||
|
||||
error_code ec;
|
||||
|
||||
@@ -438,7 +438,7 @@ void udp_socket::bind(int port)
|
||||
void udp_socket::set_proxy_settings(proxy_settings const& ps)
|
||||
{
|
||||
CHECK_MAGIC;
|
||||
mutex_t::scoped_lock l(m_mutex);
|
||||
mutex::scoped_lock l(m_mutex);
|
||||
|
||||
error_code ec;
|
||||
m_socks5_sock.close(ec);
|
||||
@@ -461,7 +461,7 @@ void udp_socket::on_name_lookup(error_code const& e, tcp::resolver::iterator i)
|
||||
if (e) return;
|
||||
CHECK_MAGIC;
|
||||
|
||||
mutex_t::scoped_lock l(m_mutex);
|
||||
mutex::scoped_lock l(m_mutex);
|
||||
|
||||
m_proxy_addr.address(i->endpoint().address());
|
||||
m_proxy_addr.port(i->endpoint().port());
|
||||
@@ -473,7 +473,7 @@ void udp_socket::on_name_lookup(error_code const& e, tcp::resolver::iterator i)
|
||||
void udp_socket::on_timeout()
|
||||
{
|
||||
CHECK_MAGIC;
|
||||
mutex_t::scoped_lock l(m_mutex);
|
||||
mutex::scoped_lock l(m_mutex);
|
||||
|
||||
error_code ec;
|
||||
m_socks5_sock.close(ec);
|
||||
@@ -483,7 +483,7 @@ void udp_socket::on_timeout()
|
||||
void udp_socket::on_connect(int ticket)
|
||||
{
|
||||
CHECK_MAGIC;
|
||||
mutex_t::scoped_lock l(m_mutex);
|
||||
mutex::scoped_lock l(m_mutex);
|
||||
|
||||
m_connection_ticket = ticket;
|
||||
error_code ec;
|
||||
@@ -496,7 +496,7 @@ void udp_socket::on_connected(error_code const& e)
|
||||
{
|
||||
CHECK_MAGIC;
|
||||
|
||||
mutex_t::scoped_lock l(m_mutex);
|
||||
mutex::scoped_lock l(m_mutex);
|
||||
m_cc.done(m_connection_ticket);
|
||||
m_connection_ticket = -1;
|
||||
if (e) return;
|
||||
@@ -527,7 +527,7 @@ void udp_socket::handshake1(error_code const& e)
|
||||
CHECK_MAGIC;
|
||||
if (e) return;
|
||||
|
||||
mutex_t::scoped_lock l(m_mutex);
|
||||
mutex::scoped_lock l(m_mutex);
|
||||
|
||||
asio::async_read(m_socks5_sock, asio::buffer(m_tmp_buf, 2)
|
||||
, boost::bind(&udp_socket::handshake2, this, _1));
|
||||
@@ -540,7 +540,7 @@ void udp_socket::handshake2(error_code const& e)
|
||||
|
||||
using namespace libtorrent::detail;
|
||||
|
||||
mutex_t::scoped_lock l(m_mutex);
|
||||
mutex::scoped_lock l(m_mutex);
|
||||
|
||||
char* p = &m_tmp_buf[0];
|
||||
int version = read_uint8(p);
|
||||
@@ -584,7 +584,7 @@ void udp_socket::handshake3(error_code const& e)
|
||||
CHECK_MAGIC;
|
||||
if (e) return;
|
||||
|
||||
mutex_t::scoped_lock l(m_mutex);
|
||||
mutex::scoped_lock l(m_mutex);
|
||||
|
||||
asio::async_read(m_socks5_sock, asio::buffer(m_tmp_buf, 2)
|
||||
, boost::bind(&udp_socket::handshake4, this, _1));
|
||||
@@ -595,7 +595,7 @@ void udp_socket::handshake4(error_code const& e)
|
||||
CHECK_MAGIC;
|
||||
if (e) return;
|
||||
|
||||
mutex_t::scoped_lock l(m_mutex);
|
||||
mutex::scoped_lock l(m_mutex);
|
||||
|
||||
using namespace libtorrent::detail;
|
||||
|
||||
@@ -614,7 +614,7 @@ void udp_socket::socks_forward_udp()
|
||||
CHECK_MAGIC;
|
||||
using namespace libtorrent::detail;
|
||||
|
||||
mutex_t::scoped_lock l(m_mutex);
|
||||
mutex::scoped_lock l(m_mutex);
|
||||
|
||||
// send SOCKS5 UDP command
|
||||
char* p = &m_tmp_buf[0];
|
||||
@@ -634,7 +634,7 @@ void udp_socket::connect1(error_code const& e)
|
||||
CHECK_MAGIC;
|
||||
if (e) return;
|
||||
|
||||
mutex_t::scoped_lock l(m_mutex);
|
||||
mutex::scoped_lock l(m_mutex);
|
||||
|
||||
asio::async_read(m_socks5_sock, asio::buffer(m_tmp_buf, 10)
|
||||
, boost::bind(&udp_socket::connect2, this, _1));
|
||||
@@ -645,7 +645,7 @@ void udp_socket::connect2(error_code const& e)
|
||||
CHECK_MAGIC;
|
||||
if (e) return;
|
||||
|
||||
mutex_t::scoped_lock l(m_mutex);
|
||||
mutex::scoped_lock l(m_mutex);
|
||||
|
||||
using namespace libtorrent::detail;
|
||||
|
||||
|
Reference in New Issue
Block a user