mirror of
https://git.deluge-torrent.org/deluge
synced 2025-04-21 12:04:51 +00:00
lt sync 1959
This commit is contained in:
parent
ec21e02cb2
commit
34b1726178
4 changed files with 21 additions and 18 deletions
|
@ -189,10 +189,13 @@ struct bandwidth_manager
|
|||
TORRENT_ASSERT(current_quota == m_current_quota);
|
||||
|
||||
typename queue_t::const_iterator j = m_queue.begin();
|
||||
++j;
|
||||
for (typename queue_t::const_iterator i = m_queue.begin()
|
||||
, end(m_queue.end()); i != end && j != end; ++i, ++j)
|
||||
TORRENT_ASSERT(i->priority >= j->priority);
|
||||
if (j != m_queue.end())
|
||||
{
|
||||
++j;
|
||||
for (typename queue_t::const_iterator i = m_queue.begin()
|
||||
, end(m_queue.end()); i != end && j != end; ++i, ++j)
|
||||
TORRENT_ASSERT(i->priority >= j->priority);
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
|
|
|
@ -376,6 +376,7 @@ namespace libtorrent
|
|||
peer_connection::~peer_connection()
|
||||
{
|
||||
// INVARIANT_CHECK;
|
||||
TORRENT_ASSERT(!m_in_constructor);
|
||||
TORRENT_ASSERT(m_disconnecting);
|
||||
|
||||
#ifdef TORRENT_VERBOSE_LOGGING
|
||||
|
@ -593,6 +594,7 @@ namespace libtorrent
|
|||
// check to make sure we don't have another connection with the same
|
||||
// info_hash and peer_id. If we do. close this connection.
|
||||
t->attach_peer(this);
|
||||
if (m_disconnecting) return;
|
||||
m_torrent = wpt;
|
||||
|
||||
TORRENT_ASSERT(!m_torrent.expired());
|
||||
|
@ -1994,16 +1996,17 @@ namespace libtorrent
|
|||
{
|
||||
session_impl::mutex_t::scoped_lock l(m_ses.m_mutex);
|
||||
|
||||
TORRENT_ASSERT(!m_in_constructor);
|
||||
boost::intrusive_ptr<peer_connection> me(this);
|
||||
|
||||
INVARIANT_CHECK;
|
||||
|
||||
if (m_disconnecting) return;
|
||||
m_disconnecting = true;
|
||||
if (m_connecting)
|
||||
if (m_connecting && m_connection_ticket >= 0)
|
||||
{
|
||||
m_ses.m_half_open.done(m_connection_ticket);
|
||||
|
||||
m_ses.m_io_service.post(boost::bind(&close_socket_ignore_error, m_socket));
|
||||
m_connection_ticket = -1;
|
||||
}
|
||||
|
||||
boost::shared_ptr<torrent> t = m_torrent.lock();
|
||||
|
||||
|
@ -2029,7 +2032,9 @@ namespace libtorrent
|
|||
m_torrent.reset();
|
||||
}
|
||||
|
||||
m_disconnecting = true;
|
||||
m_ses.close_connection(me);
|
||||
m_ses.m_io_service.post(boost::bind(&close_socket_ignore_error, m_socket));
|
||||
}
|
||||
|
||||
void peer_connection::set_upload_limit(int limit)
|
||||
|
@ -3165,7 +3170,6 @@ namespace libtorrent
|
|||
|
||||
bool peer_connection::is_seed() const
|
||||
{
|
||||
INVARIANT_CHECK;
|
||||
// if m_num_pieces == 0, we probably don't have the
|
||||
// metadata yet.
|
||||
return m_num_pieces == (int)m_have_piece.size() && m_num_pieces > 0;
|
||||
|
|
|
@ -2441,6 +2441,7 @@ namespace detail
|
|||
boost::shared_ptr<torrent> t = (*i)->associated_torrent().lock();
|
||||
|
||||
peer_connection* p = i->get();
|
||||
TORRENT_ASSERT(!p->is_disconnecting());
|
||||
if (!p->is_choked()) ++unchokes;
|
||||
if (p->peer_info_struct()
|
||||
&& p->peer_info_struct()->optimistically_unchoked)
|
||||
|
|
|
@ -2164,13 +2164,8 @@ namespace libtorrent
|
|||
throw protocol_error("reached connection limit");
|
||||
}
|
||||
|
||||
TORRENT_ASSERT(m_connections.find(p) == m_connections.end());
|
||||
peer_iterator ci = m_connections.insert(p).first;
|
||||
try
|
||||
{
|
||||
// if new_connection throws, we have to remove the
|
||||
// it from the list.
|
||||
|
||||
#ifndef TORRENT_DISABLE_EXTENSIONS
|
||||
for (extension_list_t::iterator i = m_extensions.begin()
|
||||
, end(m_extensions.end()); i != end; ++i)
|
||||
|
@ -2179,15 +2174,14 @@ namespace libtorrent
|
|||
if (pp) p->add_extension(pp);
|
||||
}
|
||||
#endif
|
||||
TORRENT_ASSERT(m_connections.find(p) == ci);
|
||||
TORRENT_ASSERT(*ci == p);
|
||||
m_policy.new_connection(**ci);
|
||||
m_policy.new_connection(*p);
|
||||
}
|
||||
catch (std::exception& e)
|
||||
{
|
||||
m_connections.erase(ci);
|
||||
throw;
|
||||
}
|
||||
TORRENT_ASSERT(m_connections.find(p) == m_connections.end());
|
||||
peer_iterator ci = m_connections.insert(p).first;
|
||||
TORRENT_ASSERT(p->remote() == p->get_socket()->remote_endpoint());
|
||||
|
||||
#ifndef NDEBUG
|
||||
|
@ -2631,6 +2625,7 @@ namespace libtorrent
|
|||
for (int c = 0; c < 2; ++c)
|
||||
{
|
||||
queue_t::const_iterator j = m_bandwidth_queue[c].begin();
|
||||
if (j == m_bandwidth_queue[c].end()) continue;
|
||||
++j;
|
||||
for (queue_t::const_iterator i = m_bandwidth_queue[c].begin()
|
||||
, end(m_bandwidth_queue[c].end()); i != end && j != end; ++i, ++j)
|
||||
|
|
Loading…
Add table
Reference in a new issue