windows fixes

This commit is contained in:
Arvid Norberg 2006-04-27 00:39:21 +00:00
parent 41810b1166
commit d1c33c0d2b
4 changed files with 8 additions and 4 deletions

View File

@ -1404,7 +1404,7 @@ namespace libtorrent
const int block_size = t->block_size();
assert(block_size > 0);
int m_desired_queue_size = static_cast<int>(queue_time
m_desired_queue_size = static_cast<int>(queue_time
* statistics().download_rate() / block_size);
if (m_desired_queue_size > max_request_queue) m_desired_queue_size
= max_request_queue;

View File

@ -784,10 +784,10 @@ namespace libtorrent
// f << "backup_blocks: " << backup_blocks.size() << "\n"
// << "used: " << std::min(num_blocks, (int)backup_blocks.size()) << "\n----\n";
#endif
interesting_blocks.insert(interesting_blocks.end()
, backup_blocks.begin(), backup_blocks.begin()
+ std::min(num_blocks, (int)backup_blocks.size()));
+ (std::min)(num_blocks, (int)backup_blocks.size()));
}
namespace
@ -832,7 +832,7 @@ namespace libtorrent
{
interesting_blocks.push_back(piece_block(*i, j));
}
num_blocks -= std::min(piece_blocks, num_blocks);
num_blocks -= (std::min)(piece_blocks, num_blocks);
assert(num_blocks >= 0);
if (num_blocks == 0) return num_blocks;
}

View File

@ -93,6 +93,7 @@ namespace
// the last argument is if we should prefer whole pieces
// for this peer. If we're downloading one piece in 20 seconds
// then use this mode.
// TODO: 20 seconds has to be customizable
bool prefer_whole_pieces = c.statistics().download_payload_rate() * 20.f
> t.torrent_file().piece_length();

View File

@ -519,6 +519,9 @@ namespace libtorrent
session_impl::mutex_t::scoped_lock l(m_ses->m_mutex);
boost::shared_ptr<torrent> t = m_ses->find_torrent(m_info_hash).lock();
// TODO: if the torrent is being checked, put this peer in a queue and
// connect it once the checking is done
if (!t) throw_invalid_handle();
peer_id id;