mirror of
https://github.com/twisterarmy/twister-core.git
synced 2025-01-22 20:44:56 +00:00
don't rely on m_connection_ticket: if we have two "on_connect" in a row,
without their "on_connected" in between, the shared variable doesn't work since the first ticket is lost. the result is a pending timeout which is never canceled (done called with -1) and libtorrent crashes.
This commit is contained in:
parent
0385f0d875
commit
241291be70
@ -176,7 +176,7 @@ namespace libtorrent
|
|||||||
void on_name_lookup(error_code const& e, tcp::resolver::iterator i);
|
void on_name_lookup(error_code const& e, tcp::resolver::iterator i);
|
||||||
void on_timeout();
|
void on_timeout();
|
||||||
void on_connect(int ticket);
|
void on_connect(int ticket);
|
||||||
void on_connected(error_code const& ec);
|
void on_connected(error_code const& ec, int ticket);
|
||||||
void handshake1(error_code const& e);
|
void handshake1(error_code const& e);
|
||||||
void handshake2(error_code const& e);
|
void handshake2(error_code const& e);
|
||||||
void handshake3(error_code const& e);
|
void handshake3(error_code const& e);
|
||||||
|
@ -885,10 +885,10 @@ void udp_socket::on_connect(int ticket)
|
|||||||
++m_outstanding_connect;
|
++m_outstanding_connect;
|
||||||
#endif
|
#endif
|
||||||
m_socks5_sock.async_connect(tcp::endpoint(m_proxy_addr.address(), m_proxy_addr.port())
|
m_socks5_sock.async_connect(tcp::endpoint(m_proxy_addr.address(), m_proxy_addr.port())
|
||||||
, boost::bind(&udp_socket::on_connected, this, _1));
|
, boost::bind(&udp_socket::on_connected, this, _1, ticket));
|
||||||
}
|
}
|
||||||
|
|
||||||
void udp_socket::on_connected(error_code const& e)
|
void udp_socket::on_connected(error_code const& e, int ticket)
|
||||||
{
|
{
|
||||||
#if defined TORRENT_ASIO_DEBUGGING
|
#if defined TORRENT_ASIO_DEBUGGING
|
||||||
complete_async("udp_socket::on_connected");
|
complete_async("udp_socket::on_connected");
|
||||||
@ -910,7 +910,7 @@ void udp_socket::on_connected(error_code const& e)
|
|||||||
if (e == asio::error::operation_aborted) return;
|
if (e == asio::error::operation_aborted) return;
|
||||||
|
|
||||||
TORRENT_ASSERT(is_single_thread());
|
TORRENT_ASSERT(is_single_thread());
|
||||||
m_cc.done(m_connection_ticket);
|
m_cc.done(ticket);
|
||||||
m_connection_ticket = -1;
|
m_connection_ticket = -1;
|
||||||
|
|
||||||
// we just called done, which means on_timeout
|
// we just called done, which means on_timeout
|
||||||
|
Loading…
x
Reference in New Issue
Block a user