From 0e20b2706cb6f165ca382a659868ec5b762ddf97 Mon Sep 17 00:00:00 2001 From: Daniel Wallin Date: Sat, 29 Nov 2003 01:54:41 +0000 Subject: [PATCH] added copyright --- src/storage.cpp | 18 ++++++++++++------ 1 file changed, 12 insertions(+), 6 deletions(-) diff --git a/src/storage.cpp b/src/storage.cpp index d97ae350f..fa5954ae2 100755 --- a/src/storage.cpp +++ b/src/storage.cpp @@ -1,6 +1,6 @@ /* -Copyright (c) 2003, Arvid Norberg +Copyright (c) 2003, Arvid Norberg, Daniel Wallin All rights reserved. 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) { - return result; + return result; } if (m_free_pieces.empty()) { - allocate_pieces(5); + allocate_pieces(5000); assert(!m_free_pieces.empty()); } 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::iterator iter( std::find( 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_file = 0; + { + boost::mutex::scoped_lock lock(mutex); + data->progress = 0.f; + } + for (torrent_info::file_iterator file_iter = m_torrent_file->begin_files(), end_iter = m_torrent_file->end_files(); file_iter != end_iter;) @@ -1156,9 +1164,7 @@ void libtorrent::storage::initialize_pieces(torrent* t, { boost::mutex::scoped_lock lock(mutex); -// TODO: finish -// data->progress = ; - + data->progress += (float)current_piece / m_torrent_file->num_pieces(); if (data->abort) return; }