Set reasonable read/write timeouts.

This commit is contained in:
Sergio Benitez 2020-09-12 02:32:09 -07:00
parent 4683407f59
commit 2162a72114
1 changed files with 4 additions and 0 deletions

View File

@ -713,6 +713,10 @@ impl Rocket {
let timeout = self.config.keep_alive.map(|s| Duration::from_secs(s as u64));
server.keep_alive(timeout);
// Set sane timeouts.
server.set_read_timeout(Some(Duration::from_secs(10)));
server.set_write_timeout(Some(Duration::from_secs(10)));
// Freeze managed state for synchronization-free accesses later.
self.state.freeze();