added copyright

This commit is contained in:
Daniel Wallin 2003-11-29 01:54:41 +00:00
parent 94919f9806
commit 0e20b2706c
1 changed files with 12 additions and 6 deletions

View File

@ -1,6 +1,6 @@
/* /*
Copyright (c) 2003, Arvid Norberg Copyright (c) 2003, Arvid Norberg, Daniel Wallin
All rights reserved. All rights reserved.
Redistribution and use in source and binary forms, with or without Redistribution and use in source and binary forms, with or without
@ -826,17 +826,20 @@ entry::integer_type libtorrent::storage::piece_storage(int piece)
if (result != -1) if (result != -1)
{ {
return result; return result;
} }
if (m_free_pieces.empty()) if (m_free_pieces.empty())
{ {
allocate_pieces(5); allocate_pieces(5000);
assert(!m_free_pieces.empty()); assert(!m_free_pieces.empty());
} }
entry::integer_type wanted_pos = piece * m_torrent_file->piece_length(); entry::integer_type wanted_pos = piece * m_torrent_file->piece_length();
int n = m_free_pieces.size();
int m = m_free_blocks.size();
std::vector<entry::integer_type>::iterator iter( std::vector<entry::integer_type>::iterator iter(
std::find( std::find(
m_free_pieces.begin() m_free_pieces.begin()
@ -1149,6 +1152,11 @@ void libtorrent::storage::initialize_pieces(torrent* t,
entry::integer_type start_of_read = 0; entry::integer_type start_of_read = 0;
entry::integer_type start_of_file = 0; entry::integer_type start_of_file = 0;
{
boost::mutex::scoped_lock lock(mutex);
data->progress = 0.f;
}
for (torrent_info::file_iterator file_iter = m_torrent_file->begin_files(), for (torrent_info::file_iterator file_iter = m_torrent_file->begin_files(),
end_iter = m_torrent_file->end_files(); end_iter = m_torrent_file->end_files();
file_iter != end_iter;) file_iter != end_iter;)
@ -1156,9 +1164,7 @@ void libtorrent::storage::initialize_pieces(torrent* t,
{ {
boost::mutex::scoped_lock lock(mutex); boost::mutex::scoped_lock lock(mutex);
// TODO: finish data->progress += (float)current_piece / m_torrent_file->num_pieces();
// data->progress = ;
if (data->abort) if (data->abort)
return; return;
} }