lt sync - fixes lockup
This commit is contained in:
parent
c13fb94bcc
commit
1d7306910f
|
@ -334,6 +334,7 @@ namespace libtorrent
|
|||
{
|
||||
++num_requested;
|
||||
blocks_requested = true;
|
||||
TORRENT_ASSERT(i->info[k].num_peers > 0);
|
||||
}
|
||||
if (i->info[k].state == block_info::state_writing)
|
||||
{
|
||||
|
|
|
@ -294,6 +294,7 @@ namespace libtorrent
|
|||
|| std::find(rq.begin(), rq.end(), *i) != rq.end())
|
||||
continue;
|
||||
|
||||
TORRENT_ASSERT(p.num_peers(*i) > 0);
|
||||
busy_pieces.push_back(*i);
|
||||
continue;
|
||||
}
|
||||
|
@ -333,6 +334,8 @@ namespace libtorrent
|
|||
p.piece_info(i->piece_index, st);
|
||||
TORRENT_ASSERT(st.requested + st.finished + st.writing == p.blocks_in_piece(i->piece_index));
|
||||
#endif
|
||||
TORRENT_ASSERT(p.is_requested(*i));
|
||||
TORRENT_ASSERT(p.num_peers(*i) > 0);
|
||||
c.add_request(*i);
|
||||
c.send_block_requests();
|
||||
}
|
||||
|
|
|
@ -797,12 +797,13 @@ namespace detail
|
|||
|
||||
INVARIANT_CHECK;
|
||||
|
||||
TORRENT_ASSERT(s.connection_speed > 0);
|
||||
TORRENT_ASSERT(s.file_pool_size > 0);
|
||||
|
||||
// less than 5 seconds unchoke interval is insane
|
||||
TORRENT_ASSERT(s.unchoke_interval >= 5);
|
||||
m_settings = s;
|
||||
if (m_settings.connection_speed <= 0) m_settings.connection_speed = 200;
|
||||
|
||||
m_files.resize(m_settings.file_pool_size);
|
||||
// replace all occurances of '\n' with ' '.
|
||||
std::string::iterator i = m_settings.user_agent.begin();
|
||||
|
@ -2643,20 +2644,23 @@ namespace detail
|
|||
|
||||
TORRENT_ASSERT(*slot_iter == p.index);
|
||||
int slot_index = static_cast<int>(slot_iter - tmp_pieces.begin());
|
||||
unsigned long adler
|
||||
= torrent_ptr->filesystem().piece_crc(
|
||||
slot_index
|
||||
, torrent_ptr->block_size()
|
||||
, p.info);
|
||||
const entry* ad = i->find_key("adler32");
|
||||
|
||||
const entry& ad = (*i)["adler32"];
|
||||
|
||||
// crc's didn't match, don't use the resume data
|
||||
if (ad.integer() != entry::integer_type(adler))
|
||||
if (ad && ad->type() == entry::int_t)
|
||||
{
|
||||
error = "checksum mismatch on piece "
|
||||
+ boost::lexical_cast<std::string>(p.index);
|
||||
return;
|
||||
unsigned long adler
|
||||
= torrent_ptr->filesystem().piece_crc(
|
||||
slot_index
|
||||
, torrent_ptr->block_size()
|
||||
, p.info);
|
||||
|
||||
// crc's didn't match, don't use the resume data
|
||||
if (ad->integer() != entry::integer_type(adler))
|
||||
{
|
||||
error = "checksum mismatch on piece "
|
||||
+ boost::lexical_cast<std::string>(p.index);
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
tmp_unfinished.push_back(p);
|
||||
|
|
|
@ -569,7 +569,7 @@ namespace libtorrent
|
|||
TORRENT_ASSERT(bits == 8 || j == num_bitmask_bytes - 1);
|
||||
}
|
||||
piece_struct["bitmask"] = bitmask;
|
||||
|
||||
/*
|
||||
TORRENT_ASSERT(t->filesystem().slot_for(i->index) >= 0);
|
||||
unsigned long adler
|
||||
= t->filesystem().piece_crc(
|
||||
|
@ -578,7 +578,7 @@ namespace libtorrent
|
|||
, i->info);
|
||||
|
||||
piece_struct["adler32"] = adler;
|
||||
|
||||
*/
|
||||
// push the struct onto the unfinished-piece list
|
||||
up.push_back(piece_struct);
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue