Files: fixes
GitOrigin-RevId: 5469a6c26fbb187fd52ddaf1c8bacfae4ddddbe9
This commit is contained in:
parent
384e96b79e
commit
347a22858c
@ -35,13 +35,14 @@ void PartsManager::set_streaming_offset(int64 offset) {
|
||||
};
|
||||
if (offset < 0 || need_check_ || (!unknown_size_flag_ && get_size() < offset)) {
|
||||
streaming_offset_ = 0;
|
||||
LOG(ERROR) << "Ignore streaming_offset (1)";
|
||||
return;
|
||||
}
|
||||
|
||||
auto part_i = offset / part_size_;
|
||||
if (part_i >= MAX_PART_COUNT) {
|
||||
if (use_part_count_limit_ && part_i >= MAX_PART_COUNT) {
|
||||
streaming_offset_ = 0;
|
||||
// error?
|
||||
LOG(ERROR) << "Ignore streaming_offset (2)";
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -30,7 +30,10 @@ class ResourceState {
|
||||
}
|
||||
|
||||
bool update_estimated_limit(int64 extra) {
|
||||
auto new_estimated_limit = used_ + extra;
|
||||
// unused() must be positive, i.e. used_ + using_ must be less than limit_
|
||||
// TODO: use exact intersection between using_ and extra.
|
||||
auto using_and_extra_intersection = min(using_, extra); // between 0 and min(using_, extra)
|
||||
auto new_estimated_limit = used_ + using_ + extra - using_and_extra_intersection;
|
||||
|
||||
// Use extra extra limit
|
||||
if (new_estimated_limit < limit_) {
|
||||
|
Reference in New Issue
Block a user