mirror of
https://github.com/servo/servo.git
synced 2025-08-06 06:00:15 +01:00
Auto merge of #13388 - servo:deadlock, r=emilio
Avoid a possible deadlock in main_fetch's synchronous code. On playpen, similar code caused a deadlock on 1.11 stable, and worked fine on nightly 1.13; it seems safer to avoid the pattern entirely. <!-- Reviewable:start --> --- This change is [<img src="https://reviewable.io/review_button.svg" height="34" align="absmiddle" alt="Reviewable"/>](https://reviewable.io/reviews/servo/servo/13388) <!-- Reviewable:end -->
This commit is contained in:
commit
1d5a05d112
1 changed files with 11 additions and 8 deletions
|
@ -312,7 +312,9 @@ fn main_fetch(request: Rc<Request>, cache: &mut CORSCache, cors_flag: bool,
|
|||
Data::Done => break,
|
||||
}
|
||||
}
|
||||
} else if let ResponseBody::Done(ref vec) = *response.body.lock().unwrap() {
|
||||
} else {
|
||||
let body = response.body.lock().unwrap();
|
||||
if let ResponseBody::Done(ref vec) = *body {
|
||||
// in case there was no channel to wait for, the body was
|
||||
// obtained synchronously via basic_fetch for data/file/about/etc
|
||||
// We should still send the body across as a chunk
|
||||
|
@ -320,7 +322,8 @@ fn main_fetch(request: Rc<Request>, cache: &mut CORSCache, cors_flag: bool,
|
|||
target.process_response_chunk(vec.clone());
|
||||
}
|
||||
} else {
|
||||
assert!(*response.body.lock().unwrap() == ResponseBody::Empty)
|
||||
assert!(*body == ResponseBody::Empty)
|
||||
}
|
||||
}
|
||||
|
||||
// overloaded similarly to process_response
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue