windows fixes
This commit is contained in:
@@ -1404,7 +1404,7 @@ namespace libtorrent
|
|||||||
const int block_size = t->block_size();
|
const int block_size = t->block_size();
|
||||||
assert(block_size > 0);
|
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);
|
* statistics().download_rate() / block_size);
|
||||||
if (m_desired_queue_size > max_request_queue) m_desired_queue_size
|
if (m_desired_queue_size > max_request_queue) m_desired_queue_size
|
||||||
= max_request_queue;
|
= max_request_queue;
|
||||||
|
@@ -784,10 +784,10 @@ namespace libtorrent
|
|||||||
// f << "backup_blocks: " << backup_blocks.size() << "\n"
|
// f << "backup_blocks: " << backup_blocks.size() << "\n"
|
||||||
// << "used: " << std::min(num_blocks, (int)backup_blocks.size()) << "\n----\n";
|
// << "used: " << std::min(num_blocks, (int)backup_blocks.size()) << "\n----\n";
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
interesting_blocks.insert(interesting_blocks.end()
|
interesting_blocks.insert(interesting_blocks.end()
|
||||||
, backup_blocks.begin(), backup_blocks.begin()
|
, backup_blocks.begin(), backup_blocks.begin()
|
||||||
+ std::min(num_blocks, (int)backup_blocks.size()));
|
+ (std::min)(num_blocks, (int)backup_blocks.size()));
|
||||||
}
|
}
|
||||||
|
|
||||||
namespace
|
namespace
|
||||||
@@ -832,7 +832,7 @@ namespace libtorrent
|
|||||||
{
|
{
|
||||||
interesting_blocks.push_back(piece_block(*i, j));
|
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);
|
assert(num_blocks >= 0);
|
||||||
if (num_blocks == 0) return num_blocks;
|
if (num_blocks == 0) return num_blocks;
|
||||||
}
|
}
|
||||||
|
@@ -93,6 +93,7 @@ namespace
|
|||||||
// the last argument is if we should prefer whole pieces
|
// the last argument is if we should prefer whole pieces
|
||||||
// for this peer. If we're downloading one piece in 20 seconds
|
// for this peer. If we're downloading one piece in 20 seconds
|
||||||
// then use this mode.
|
// then use this mode.
|
||||||
|
// TODO: 20 seconds has to be customizable
|
||||||
bool prefer_whole_pieces = c.statistics().download_payload_rate() * 20.f
|
bool prefer_whole_pieces = c.statistics().download_payload_rate() * 20.f
|
||||||
> t.torrent_file().piece_length();
|
> t.torrent_file().piece_length();
|
||||||
|
|
||||||
|
@@ -519,6 +519,9 @@ namespace libtorrent
|
|||||||
|
|
||||||
session_impl::mutex_t::scoped_lock l(m_ses->m_mutex);
|
session_impl::mutex_t::scoped_lock l(m_ses->m_mutex);
|
||||||
boost::shared_ptr<torrent> t = m_ses->find_torrent(m_info_hash).lock();
|
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();
|
if (!t) throw_invalid_handle();
|
||||||
|
|
||||||
peer_id id;
|
peer_id id;
|
||||||
|
Reference in New Issue
Block a user