streaming fix
This commit is contained in:
parent
1e48745173
commit
118ba5e9c4
|
@ -1122,7 +1122,8 @@ namespace libtorrent
|
||||||
// average of current rate and peak
|
// average of current rate and peak
|
||||||
// rate = (rate + m_download_rate_peak) / 2;
|
// rate = (rate + m_download_rate_peak) / 2;
|
||||||
|
|
||||||
return seconds((m_outstanding_bytes + m_queued_time_critical * t->block_size()) / rate);
|
return milliseconds((m_outstanding_bytes
|
||||||
|
+ m_queued_time_critical * t->block_size() * 1000) / rate);
|
||||||
}
|
}
|
||||||
|
|
||||||
void peer_connection::add_stat(size_type downloaded, size_type uploaded)
|
void peer_connection::add_stat(size_type downloaded, size_type uploaded)
|
||||||
|
|
|
@ -10010,7 +10010,13 @@ namespace libtorrent
|
||||||
// if this peer's download time exceeds 2 seconds, we're done.
|
// if this peer's download time exceeds 2 seconds, we're done.
|
||||||
// We don't want to build unreasonably long request queues
|
// We don't want to build unreasonably long request queues
|
||||||
if (!peers.empty() && peers[0]->download_queue_time() > milliseconds(2000))
|
if (!peers.empty() && peers[0]->download_queue_time() > milliseconds(2000))
|
||||||
|
{
|
||||||
|
#if TORRENT_DEBUG_STREAMING > 1
|
||||||
|
printf("queue time: %d ms, done\n"
|
||||||
|
, int(total_milliseconds(peers[0]->download_queue_time())));
|
||||||
|
#endif
|
||||||
break;
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
// pick the peer with the lowest download_queue_time that has i->piece
|
// pick the peer with the lowest download_queue_time that has i->piece
|
||||||
std::vector<peer_connection*>::iterator p = std::find_if(peers.begin(), peers.end()
|
std::vector<peer_connection*>::iterator p = std::find_if(peers.begin(), peers.end()
|
||||||
|
@ -10086,7 +10092,7 @@ namespace libtorrent
|
||||||
bool already_requested = std::find_if(dq.begin(), dq.end()
|
bool already_requested = std::find_if(dq.begin(), dq.end()
|
||||||
, has_block(b)) != dq.end();
|
, has_block(b)) != dq.end();
|
||||||
|
|
||||||
if (busy_mode && already_requested)
|
if (already_requested)
|
||||||
{
|
{
|
||||||
// if the piece is stalled, we may end up picking a block
|
// if the piece is stalled, we may end up picking a block
|
||||||
// that we've already requested from this peer. If so, we should
|
// that we've already requested from this peer. If so, we should
|
||||||
|
@ -10129,9 +10135,7 @@ namespace libtorrent
|
||||||
// makes us actually send it later
|
// makes us actually send it later
|
||||||
peers_with_requests.insert(peers_with_requests.begin(), &c);
|
peers_with_requests.insert(peers_with_requests.begin(), &c);
|
||||||
}
|
}
|
||||||
|
else
|
||||||
if (!already_in_queue
|
|
||||||
&& !already_requested)
|
|
||||||
{
|
{
|
||||||
if (!c.add_request(b, peer_connection::req_time_critical
|
if (!c.add_request(b, peer_connection::req_time_critical
|
||||||
| (busy_mode ? peer_connection::req_busy : 0)))
|
| (busy_mode ? peer_connection::req_busy : 0)))
|
||||||
|
|
Loading…
Reference in New Issue