set_read_timeout() can fail, don't expect() it not to
This commit is contained in:
parent
ed58bcda4c
commit
36c0cb052b
|
@ -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(|_| {
|
||||
|
|
Loading…
Reference in New Issue