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

(cherry picked from commit 36c0cb052b)
This commit is contained in:
Michael Vines
2020-02-11 13:31:55 -07:00
parent 1f30d1e77a
commit bb64c73aa2

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(|_| {