*** empty log message ***

This commit is contained in:
Magnus Jonsson 2004-01-26 01:45:30 +00:00
parent fd9fba2964
commit b716a40795
2 changed files with 19 additions and 5 deletions

View File

@ -1075,7 +1075,6 @@ namespace libtorrent
for (map_iter i = begin2; i != end2; ++i) for (map_iter i = begin2; i != end2; ++i)
matching_pieces.push_back(i->second); matching_pieces.push_back(i->second);
// no piece matched the data in the slot // no piece matched the data in the slot
if (matching_pieces.empty()) if (matching_pieces.empty())
return -1; return -1;
@ -1124,8 +1123,11 @@ namespace libtorrent
assert(m_piece_to_slot[piece_index] != current_slot); assert(m_piece_to_slot[piece_index] != current_slot);
assert(m_piece_to_slot[piece_index] >= 0); assert(m_piece_to_slot[piece_index] >= 0);
m_piece_to_slot[piece_index] = has_no_slot; m_piece_to_slot[piece_index] = has_no_slot;
have_pieces[piece_index] = false;
} }
assert(have_pieces[piece_index] == false);
assert(m_piece_to_slot[piece_index] == has_no_slot);
have_pieces[piece_index] = true; have_pieces[piece_index] = true;
return piece_index; return piece_index;
} }
@ -1142,9 +1144,19 @@ namespace libtorrent
break; break;
} }
if (free_piece >= 0) have_pieces[free_piece] = true; if (free_piece >= 0)
{
assert(have_pieces[free_piece] == false);
assert(m_piece_to_slot[free_piece] == has_no_slot);
have_pieces[free_piece] = true;
return free_piece; return free_piece;
} }
else
{
assert(free_piece == -1);
return -1;
}
}
void piece_manager::impl::check_pieces( void piece_manager::impl::check_pieces(
boost::mutex& mutex boost::mutex& mutex
@ -1256,12 +1268,14 @@ namespace libtorrent
// the slot was identified as piece 'piece_index' // the slot was identified as piece 'piece_index'
m_piece_to_slot[piece_index] = current_slot; m_piece_to_slot[piece_index] = current_slot;
m_slot_to_piece[current_slot] = piece_index; m_slot_to_piece[current_slot] = piece_index;
} }
else else
{ {
// the data in the slot was not recognized // the data in the slot was not recognized
// consider the slot free // consider the slot free
assert(m_slot_to_piece[current_slot]==unallocated);
m_slot_to_piece[current_slot] = unassigned; m_slot_to_piece[current_slot] = unassigned;
m_free_slots.push_back(current_slot); m_free_slots.push_back(current_slot);
} }

View File

@ -224,7 +224,7 @@ namespace libtorrent
, m_storage(m_torrent_file, save_path) , m_storage(m_torrent_file, save_path)
, m_next_request(boost::posix_time::second_clock::local_time()) , m_next_request(boost::posix_time::second_clock::local_time())
, m_duration(1800) , m_duration(1800)
, m_policy(new policy(this)) , m_policy(new policy(this)) // warning: uses this in member init list
, m_ses(ses) , m_ses(ses)
, m_picker(torrent_file.piece_length() / m_block_size, , m_picker(torrent_file.piece_length() / m_block_size,
static_cast<int>((torrent_file.total_size()+m_block_size-1)/m_block_size)) static_cast<int>((torrent_file.total_size()+m_block_size-1)/m_block_size))