set_read_timeout() can fail, don't expect() it not to

This commit is contained in:
Michael Vines 2020-02-11 13:31:55 -07:00
parent ed58bcda4c
commit 36c0cb052b
1 changed files with 1 additions and 3 deletions

View File

@ -37,11 +37,9 @@ fn ip_echo_server_request(
// from an HTTP server
bytes.push(b'\n');
stream.set_read_timeout(Some(Duration::new(10, 0)))?;
stream.write_all(&bytes)?;
stream.shutdown(std::net::Shutdown::Write)?;
stream
.set_read_timeout(Some(Duration::new(10, 0)))
.expect("set_read_timeout");
stream.read_to_end(&mut data)
})
.and_then(|_| {