Change a panic to an error when a client sends a request but disconnects before a response can be sent.

This commit is contained in:
Jeb Rosen 2019-12-14 12:49:42 -08:00 committed by Sergio Benitez
parent 70096c1bd4
commit c2da8a21d8
1 changed files with 1 additions and 2 deletions

View File

@ -131,8 +131,7 @@ impl Rocket {
let send_response = move |hyp_res: hyper::ResponseBuilder, body| -> io::Result<()> {
let response = hyp_res.body(body).map_err(|e| io::Error::new(io::ErrorKind::Other, e))?;
tx.send(response).expect("channel receiver should not be dropped");
Ok(())
tx.send(response).map_err(|_| io::Error::new(io::ErrorKind::BrokenPipe, "Client disconnected before the response was started"))
};
match response.body() {