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

5
libtorrent/src/peer_connection.cpp

@ -4571,6 +4571,11 @@ namespace libtorrent @@ -4571,6 +4571,11 @@ namespace libtorrent
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 defined TORRENT_VERBOSE_LOGGING

12
libtorrent/src/torrent.cpp

@ -944,7 +944,7 @@ namespace libtorrent @@ -944,7 +944,7 @@ namespace libtorrent
pieces->push_back( std::string(j.buffer, ret));
} else {
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)--;
@ -3113,6 +3113,16 @@ namespace libtorrent @@ -3113,6 +3113,16 @@ namespace libtorrent
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)
{
// INVARIANT_CHECK;

Loading…
Cancel
Save