Browse Source

recheck piece just before sending to other torrent peer. fix #15.

miguelfreitas
Miguel Freitas 11 years ago
parent
commit
fa386c250d
  1. 11
      libtorrent/src/peer_connection.cpp

11
libtorrent/src/peer_connection.cpp

@ -4609,7 +4609,18 @@ namespace libtorrent
#if TORRENT_DISK_STATS #if TORRENT_DISK_STATS
if (j.buffer) m_ses.m_disk_thread.rename_buffer(j.buffer, "dispatched send buffer"); if (j.buffer) m_ses.m_disk_thread.rename_buffer(j.buffer, "dispatched send buffer");
#endif #endif
// [MF] recheck piece just before sending (issue #15)
std::string errmsg;
if( acceptSignedPost(j.buffer, j.buffer_size, j.storage->info()->name(),
j.piece, errmsg, NULL ) ) {
write_piece(r, buffer); write_piece(r, buffer);
} else {
printf("on_disk_read_complete: [piece: %d l: %d] failed! (%s)\n",
j.piece, j.buffer_size, errmsg.c_str());
t->we_dont_have(j.piece);
m_ses.free_disk_buffer(buffer.get());
buffer.release();
}
} }
void peer_connection::assign_bandwidth(int channel, int amount) void peer_connection::assign_bandwidth(int channel, int amount)

Loading…
Cancel
Save