forked from premiere/premiere-libtorrent
*** empty log message ***
This commit is contained in:
parent
9ac327e23b
commit
72d06a74a9
|
@ -80,11 +80,11 @@ namespace
|
|||
+ d.fractional_seconds() / 1000.f;
|
||||
}
|
||||
|
||||
// the case where ignore_block is motivated is if two peers
|
||||
// the case where ignore_peer is motivated is if two peers
|
||||
// have only one piece that we don't have, and it's the
|
||||
// same piece for both peers. Then they might get into an
|
||||
// infinite recursion, fighting to request the same block.
|
||||
void request_a_block(torrent& t, peer_connection& c, piece_block ignore_block = piece_block(-1, -1))
|
||||
// infinite recursion, fighting to request the same blocks.
|
||||
void request_a_block(torrent& t, peer_connection& c, peer_connection* ignore_peer = 0)
|
||||
{
|
||||
float time_for_last_piece = to_seconds(c.last_piece_time());
|
||||
if (time_for_last_piece == 0) time_for_last_piece = 0.001f;
|
||||
|
@ -132,7 +132,6 @@ namespace
|
|||
i != interesting_pieces.end();
|
||||
++i)
|
||||
{
|
||||
if (*i == ignore_block) continue;
|
||||
if (p.is_downloading(*i))
|
||||
{
|
||||
busy_pieces.push_back(*i);
|
||||
|
@ -168,6 +167,8 @@ namespace
|
|||
i != t.end();
|
||||
++i)
|
||||
{
|
||||
if (i->second == ignore_peer) continue;
|
||||
|
||||
const std::deque<piece_block>& queue = i->second->download_queue();
|
||||
const float weight = i->second->statistics().down_peak()
|
||||
/ i->second->download_queue().size();
|
||||
|
@ -186,15 +187,13 @@ namespace
|
|||
if (peer == 0)
|
||||
{
|
||||
// we probably couldn't request the block because
|
||||
// we are ignoring a certain block
|
||||
// we are ignoring a certain peer
|
||||
return;
|
||||
}
|
||||
|
||||
// this peer doesn't have a faster connection than the
|
||||
// slowest peer. Don't take over any blocks
|
||||
// TODO: is this correct? shouldn't it take over a piece
|
||||
// anyways?
|
||||
//if (c.statistics().down_peak() / c.download_queue().size() <= down_speed) return;
|
||||
if (c.statistics().down_peak() / c.download_queue().size() <= down_speed) return;
|
||||
|
||||
// find a suitable block to take over from this peer
|
||||
|
||||
|
@ -213,7 +212,7 @@ namespace
|
|||
// the one we interrupted may need to request a new piece
|
||||
// make sure it doesn't request the block we just requested
|
||||
// by giving it as the ignore_block
|
||||
request_a_block(t, *peer, block);
|
||||
request_a_block(t, *peer, &c);
|
||||
|
||||
num_requests--;
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue