mirror of
https://github.com/codex-storage/deluge.git
synced 2025-01-11 03:55:43 +00:00
lt sync 3060
This commit is contained in:
parent
fcc975006a
commit
3f46136362
@ -65,7 +65,13 @@ namespace libtorrent
|
||||
proxy_settings const& get_proxy_settings() { return m_proxy_settings; }
|
||||
|
||||
#ifdef TORRENT_DEBUG
|
||||
~udp_socket() { m_magic = 0; }
|
||||
~udp_socket()
|
||||
{
|
||||
TORRENT_ASSERT(m_magic == 0x1337);
|
||||
TORRENT_ASSERT(m_outstanding == 0);
|
||||
TORRENT_ASSERT(!m_callback);
|
||||
m_magic = 0;
|
||||
}
|
||||
#endif
|
||||
|
||||
private:
|
||||
|
@ -36,6 +36,6 @@ POSSIBILITY OF SUCH DAMAGE.
|
||||
#define LIBTORRENT_VERSION_MAJOR 0
|
||||
#define LIBTORRENT_VERSION_MINOR 14
|
||||
|
||||
#define LIBTORRENT_VERSION "0.14.1.0"
|
||||
#define LIBTORRENT_VERSION "0.14.2.0"
|
||||
|
||||
#endif
|
||||
|
@ -1942,6 +1942,8 @@ namespace libtorrent
|
||||
// is finished
|
||||
int piece_manager::check_files(int& current_slot, int& have_piece, std::string& error)
|
||||
{
|
||||
if (m_state == state_none) return check_no_fastresume(error);
|
||||
|
||||
TORRENT_ASSERT(int(m_piece_to_slot.size()) == m_files.num_pieces());
|
||||
|
||||
current_slot = m_current_slot;
|
||||
|
@ -497,6 +497,8 @@ namespace libtorrent
|
||||
}
|
||||
}
|
||||
|
||||
if (!m_urls.empty())
|
||||
{
|
||||
// shuffle each tier
|
||||
std::vector<announce_entry>::iterator start = m_urls.begin();
|
||||
std::vector<announce_entry>::iterator stop;
|
||||
@ -512,6 +514,7 @@ namespace libtorrent
|
||||
}
|
||||
std::random_shuffle(start, stop);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
if (m_urls.empty())
|
||||
|
@ -45,6 +45,7 @@ udp_socket::udp_socket(asio::io_service& ios, udp_socket::callback_t const& c
|
||||
void udp_socket::send(udp::endpoint const& ep, char const* p, int len, error_code& ec)
|
||||
{
|
||||
CHECK_MAGIC;
|
||||
TORRENT_ASSERT(m_ipv4_sock.is_open());
|
||||
if (m_tunnel_packets)
|
||||
{
|
||||
// send udp packets through SOCKS5 server
|
||||
@ -72,8 +73,8 @@ void udp_socket::on_read(udp::socket* s, error_code const& e, std::size_t bytes_
|
||||
{
|
||||
// "this" may be destructed in the callback
|
||||
// that's why we need to unlock
|
||||
l.unlock();
|
||||
callback_t tmp = m_callback;
|
||||
l.unlock();
|
||||
m_callback.clear();
|
||||
}
|
||||
return;
|
||||
@ -84,6 +85,7 @@ void udp_socket::on_read(udp::socket* s, error_code const& e, std::size_t bytes_
|
||||
|
||||
if (e)
|
||||
{
|
||||
l.unlock();
|
||||
#ifndef BOOST_NO_EXCEPTIONS
|
||||
try {
|
||||
#endif
|
||||
@ -94,6 +96,7 @@ void udp_socket::on_read(udp::socket* s, error_code const& e, std::size_t bytes_
|
||||
#ifndef BOOST_NO_EXCEPTIONS
|
||||
} catch(std::exception&) {}
|
||||
#endif
|
||||
l.lock();
|
||||
|
||||
// don't stop listening on recoverable errors
|
||||
if (e != asio::error::host_unreachable
|
||||
@ -122,9 +125,16 @@ void udp_socket::on_read(udp::socket* s, error_code const& e, std::size_t bytes_
|
||||
#endif
|
||||
|
||||
if (m_tunnel_packets && m_v4_ep == m_proxy_addr)
|
||||
{
|
||||
l.unlock();
|
||||
unwrap(e, m_v4_buf, bytes_transferred);
|
||||
}
|
||||
else
|
||||
{
|
||||
l.unlock();
|
||||
m_callback(e, m_v4_ep, m_v4_buf, bytes_transferred);
|
||||
}
|
||||
l.lock();
|
||||
|
||||
#ifndef BOOST_NO_EXCEPTIONS
|
||||
} catch(std::exception&) {}
|
||||
@ -139,13 +149,20 @@ void udp_socket::on_read(udp::socket* s, error_code const& e, std::size_t bytes_
|
||||
#endif
|
||||
|
||||
if (m_tunnel_packets && m_v6_ep == m_proxy_addr)
|
||||
{
|
||||
l.unlock();
|
||||
unwrap(e, m_v6_buf, bytes_transferred);
|
||||
}
|
||||
else
|
||||
{
|
||||
l.unlock();
|
||||
m_callback(e, m_v6_ep, m_v6_buf, bytes_transferred);
|
||||
}
|
||||
|
||||
#ifndef BOOST_NO_EXCEPTIONS
|
||||
} catch(std::exception&) {}
|
||||
#endif
|
||||
l.lock();
|
||||
s->async_receive_from(asio::buffer(m_v6_buf, sizeof(m_v6_buf))
|
||||
, m_v6_ep, boost::bind(&udp_socket::on_read, this, s, _1, _2));
|
||||
}
|
||||
@ -215,6 +232,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);
|
||||
TORRENT_ASSERT(m_magic == 0x1337);
|
||||
|
||||
error_code ec;
|
||||
@ -232,6 +250,7 @@ void udp_socket::close()
|
||||
// "this" may be destructed in the callback
|
||||
callback_t tmp = m_callback;
|
||||
m_callback.clear();
|
||||
l.unlock();
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user