Browse Source

Merge

miguelfreitas
Miguel Freitas 11 years ago
parent
commit
5fcf9b452a
  1. 2
      libtorrent/include/libtorrent/torrent.hpp
  2. 5
      libtorrent/src/peer_connection.cpp
  3. 12
      libtorrent/src/torrent.cpp

2
libtorrent/include/libtorrent/torrent.hpp

@ -529,6 +529,8 @@ namespace libtorrent
// only once per piece // only once per piece
void we_have(int index, boost::uint32_t post_flags); void we_have(int index, boost::uint32_t post_flags);
void we_dont_have(int index);
int num_have() const int num_have() const
{ {
return has_picker() return has_picker()

5
libtorrent/src/peer_connection.cpp

@ -4571,6 +4571,11 @@ namespace libtorrent
if (ret <= 0) if (ret <= 0)
{ {
if (t->has_picker() && t->have_piece(j.piece) ) {
printf("on_disk_read_complete: read error (database corrupt?) - setting we_dont_have(%d)\n", j.piece);
t->we_dont_have(j.piece);
}
if (ret == -3) if (ret == -3)
{ {
#if defined TORRENT_VERBOSE_LOGGING #if defined TORRENT_VERBOSE_LOGGING

12
libtorrent/src/torrent.cpp

@ -944,7 +944,7 @@ namespace libtorrent
pieces->push_back( std::string(j.buffer, ret)); pieces->push_back( std::string(j.buffer, ret));
} else { } else {
printf("piece read error (database corrupt?) - setting we_dont_have(%d)\n", j.piece); printf("piece read error (database corrupt?) - setting we_dont_have(%d)\n", j.piece);
m_picker->we_dont_have(j.piece); we_dont_have(j.piece);
} }
(*reqs)--; (*reqs)--;
@ -3113,6 +3113,16 @@ namespace libtorrent
m_picker->we_have(index, post_flags); m_picker->we_have(index, post_flags);
} }
void torrent::we_dont_have(int index)
{
TORRENT_ASSERT(m_ses.is_network_thread());
// update m_file_progress
TORRENT_ASSERT(m_picker);
m_picker->we_dont_have(index);
}
void torrent::piece_passed(int index, boost::uint32_t post_flags) void torrent::piece_passed(int index, boost::uint32_t post_flags)
{ {
// INVARIANT_CHECK; // INVARIANT_CHECK;

Loading…
Cancel
Save