Skip to content

Commit fe74c8f

Browse files
committed
Fix the tcp_echo_server test to avoid hangs.
Shut down the writing end of the socket after writing, to allow the server to end the stream, allowing a `read_to_end` on the reading end to reach the end of the stream.
1 parent b7b5207 commit fe74c8f

File tree

1 file changed

+2
-0
lines changed

1 file changed

+2
-0
lines changed

test-programs/artifacts/tests/tcp_echo_server.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -106,6 +106,8 @@ fn tcp_echo_server() -> Result<()> {
106106
tcpstream.write_all(MESSAGE).context("write to socket")?;
107107
println!("wrote to echo server");
108108

109+
tcpstream.shutdown(Shutdown::Write)?;
110+
109111
let mut readback = Vec::new();
110112
tcpstream
111113
.read_to_end(&mut readback)

0 commit comments

Comments
 (0)