some cleanup and moved the upload_only = true to avoid failing an invariant check
This commit is contained in:
parent
fd6630de5a
commit
ce9cf5657d
|
@ -1482,9 +1482,9 @@ namespace libtorrent
|
||||||
#if defined TORRENT_VERBOSE_LOGGING || defined TORRENT_ERROR_LOGGING
|
#if defined TORRENT_VERBOSE_LOGGING || defined TORRENT_ERROR_LOGGING
|
||||||
(*m_logger) << " got redundant HAVE message for index: " << index << "\n";
|
(*m_logger) << " got redundant HAVE message for index: " << index << "\n";
|
||||||
#endif
|
#endif
|
||||||
|
return;
|
||||||
}
|
}
|
||||||
else
|
|
||||||
{
|
|
||||||
m_have_piece.set_bit(index);
|
m_have_piece.set_bit(index);
|
||||||
++m_num_pieces;
|
++m_num_pieces;
|
||||||
|
|
||||||
|
@ -1492,15 +1492,9 @@ namespace libtorrent
|
||||||
// we have the metadata and if
|
// we have the metadata and if
|
||||||
// we're not a seed (in which case
|
// we're not a seed (in which case
|
||||||
// we won't have a piece picker)
|
// we won't have a piece picker)
|
||||||
if (t->valid_metadata())
|
if (!t->valid_metadata()) return;
|
||||||
{
|
|
||||||
t->peer_has(index);
|
|
||||||
|
|
||||||
if (!t->have_piece(index)
|
t->peer_has(index);
|
||||||
&& !t->is_seed()
|
|
||||||
&& !is_interesting()
|
|
||||||
&& t->picker().piece_priority(index) != 0)
|
|
||||||
t->get_policy().peer_is_interesting(*this);
|
|
||||||
|
|
||||||
// this will disregard all have messages we get within
|
// this will disregard all have messages we get within
|
||||||
// the first two seconds. Since some clients implements
|
// the first two seconds. Since some clients implements
|
||||||
|
@ -1512,7 +1506,6 @@ namespace libtorrent
|
||||||
// update bytes downloaded since last timer
|
// update bytes downloaded since last timer
|
||||||
m_remote_bytes_dled += t->torrent_file().piece_size(index);
|
m_remote_bytes_dled += t->torrent_file().piece_size(index);
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
// it's important to not disconnect before we have
|
// it's important to not disconnect before we have
|
||||||
// updated the piece picker, otherwise we will incorrectly
|
// updated the piece picker, otherwise we will incorrectly
|
||||||
|
@ -1525,6 +1518,12 @@ namespace libtorrent
|
||||||
if (is_disconnecting()) return;
|
if (is_disconnecting()) return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (!t->have_piece(index)
|
||||||
|
&& !t->is_seed()
|
||||||
|
&& !is_interesting()
|
||||||
|
&& t->picker().piece_priority(index) != 0)
|
||||||
|
t->get_policy().peer_is_interesting(*this);
|
||||||
|
|
||||||
// if we're super seeding, this might mean that somebody
|
// if we're super seeding, this might mean that somebody
|
||||||
// forwarded this piece. In which case we need to give
|
// forwarded this piece. In which case we need to give
|
||||||
// a new piece to that peer
|
// a new piece to that peer
|
||||||
|
@ -1542,7 +1541,6 @@ namespace libtorrent
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
// -----------------------------
|
// -----------------------------
|
||||||
// --------- BITFIELD ----------
|
// --------- BITFIELD ----------
|
||||||
|
|
Loading…
Reference in New Issue