fixed bug in disk cache flush, largest contiguous function
This commit is contained in:
@@ -549,6 +549,7 @@ namespace libtorrent
|
|||||||
current = 0;
|
current = 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
if (current > ret) ret = current;
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -576,8 +577,13 @@ namespace libtorrent
|
|||||||
start = i + 1;
|
start = i + 1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
if (current > len)
|
||||||
|
{
|
||||||
|
len = current;
|
||||||
|
pos = start;
|
||||||
|
}
|
||||||
|
|
||||||
if (len < lower_limit) return 0;
|
if (len < lower_limit || len <= 0) return 0;
|
||||||
len = flush_range(e, pos, pos + len, l);
|
len = flush_range(e, pos, pos + len, l);
|
||||||
if (e->num_blocks == 0) m_pieces.erase(e);
|
if (e->num_blocks == 0) m_pieces.erase(e);
|
||||||
return len;
|
return len;
|
||||||
@@ -642,6 +648,9 @@ namespace libtorrent
|
|||||||
, int start, int end, mutex_t::scoped_lock& l)
|
, int start, int end, mutex_t::scoped_lock& l)
|
||||||
{
|
{
|
||||||
INVARIANT_CHECK;
|
INVARIANT_CHECK;
|
||||||
|
|
||||||
|
TORRENT_ASSERT(start < end);
|
||||||
|
|
||||||
// TODO: copy *e and unlink it before unlocking
|
// TODO: copy *e and unlink it before unlocking
|
||||||
cached_piece_entry& p = *e;
|
cached_piece_entry& p = *e;
|
||||||
int piece_size = p.storage->info()->piece_size(p.piece);
|
int piece_size = p.storage->info()->piece_size(p.piece);
|
||||||
|
Reference in New Issue
Block a user