forked from premiere/premiere-libtorrent
added storage assert, fixed policy assert
This commit is contained in:
parent
af95c01f24
commit
338eedf961
|
@ -344,7 +344,8 @@ namespace libtorrent
|
|||
std::multimap<sha1_hash, int> m_hash_to_piece;
|
||||
|
||||
// this map contains partial hashes for downloading
|
||||
// pieces.
|
||||
// pieces. This is only accessed from within the
|
||||
// disk-io thread.
|
||||
std::map<int, partial_hash> m_piece_hasher;
|
||||
|
||||
disk_io_thread& m_io_thread;
|
||||
|
|
|
@ -1422,7 +1422,7 @@ namespace libtorrent
|
|||
++total_connections;
|
||||
if (!p.connection)
|
||||
{
|
||||
assert(m_torrent->connection_for(p.ip) == 0);
|
||||
// assert(m_torrent->connection_for(p.ip) == 0);
|
||||
continue;
|
||||
}
|
||||
if (!m_torrent->settings().allow_multiple_connections_per_ip)
|
||||
|
|
|
@ -400,16 +400,20 @@ namespace libtorrent
|
|||
partial.update(&m_scratch_buffer[0], ph.offset);
|
||||
whole.update(&m_scratch_buffer[0], slot_size1);
|
||||
hasher partial_copy = ph.h;
|
||||
std::cerr << partial_copy.final() << " " << partial.final() << std::endl;
|
||||
assert(ph.offset == 0 || partial_copy.final() == partial.final());
|
||||
#endif
|
||||
int slot_size = piece_size - ph.offset;
|
||||
if (slot_size == 0) return ph.h.final();
|
||||
if (slot_size == 0)
|
||||
{
|
||||
assert(ph.h.final() == whole.final());
|
||||
return ph.h.final();
|
||||
}
|
||||
m_scratch_buffer.resize(slot_size);
|
||||
read_impl(&m_scratch_buffer[0], slot, ph.offset, slot_size, true);
|
||||
ph.h.update(&m_scratch_buffer[0], slot_size);
|
||||
sha1_hash ret = ph.h.final();
|
||||
assert(whole.final() == ret);
|
||||
return ret;
|
||||
assert(whole.final() == ph.h.final());
|
||||
return ph.h.final();
|
||||
}
|
||||
|
||||
void storage::initialize(bool allocate_files)
|
||||
|
@ -996,9 +1000,6 @@ namespace libtorrent
|
|||
int err = statfs(query_path.native_directory_string().c_str(), &buf);
|
||||
if (err == 0)
|
||||
{
|
||||
#ifndef NDEBUG
|
||||
std::cerr << "buf.f_type " << std::hex << buf.f_type << std::endl;
|
||||
#endif
|
||||
switch (buf.f_type)
|
||||
{
|
||||
case 0x5346544e: // NTFS
|
||||
|
@ -1297,6 +1298,7 @@ namespace libtorrent
|
|||
if (i != m_piece_hasher.end())
|
||||
{
|
||||
assert(i->second.offset > 0);
|
||||
assert(offset >= i->second.offset);
|
||||
if (offset == i->second.offset)
|
||||
{
|
||||
i->second.offset += size;
|
||||
|
|
Loading…
Reference in New Issue