提交 086b2974 编写于 作者: J Jakub Bukaj

rollup merge of #18985: alexcrichton/issue-18900

......@@ -661,23 +661,22 @@ fn write_close_ip4() {
let addr = next_test_ip4();
let mut acceptor = TcpListener::bind(addr).listen();
let (tx, rx) = channel();
spawn(proc() {
let _stream = TcpStream::connect(addr);
// Close
drop(TcpStream::connect(addr));
tx.send(());
});
let mut stream = acceptor.accept();
rx.recv();
let buf = [0];
loop {
match stream.write(buf) {
Ok(..) => {}
Err(e) => {
assert!(e.kind == ConnectionReset ||
e.kind == BrokenPipe ||
e.kind == ConnectionAborted,
"unknown error: {}", e);
break;
}
match stream.write(buf) {
Ok(..) => {}
Err(e) => {
assert!(e.kind == ConnectionReset ||
e.kind == BrokenPipe ||
e.kind == ConnectionAborted,
"unknown error: {}", e);
}
}
}
......@@ -687,23 +686,22 @@ fn write_close_ip6() {
let addr = next_test_ip6();
let mut acceptor = TcpListener::bind(addr).listen();
let (tx, rx) = channel();
spawn(proc() {
let _stream = TcpStream::connect(addr);
// Close
drop(TcpStream::connect(addr));
tx.send(());
});
let mut stream = acceptor.accept();
rx.recv();
let buf = [0];
loop {
match stream.write(buf) {
Ok(..) => {}
Err(e) => {
assert!(e.kind == ConnectionReset ||
e.kind == BrokenPipe ||
e.kind == ConnectionAborted,
"unknown error: {}", e);
break;
}
match stream.write(buf) {
Ok(..) => {}
Err(e) => {
assert!(e.kind == ConnectionReset ||
e.kind == BrokenPipe ||
e.kind == ConnectionAborted,
"unknown error: {}", e);
}
}
}
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册