File tree Expand file tree Collapse file tree 1 file changed +0
-4
lines changed Expand file tree Collapse file tree 1 file changed +0
-4
lines changed Original file line number Diff line number Diff line change @@ -11,24 +11,20 @@ fn smoke_bind_connect() {
11
11
let tmp = std:: env:: temp_dir ( ) ;
12
12
let sock_path = tmp. join ( "rust-test-uds.sock" ) ;
13
13
14
- // 1. 绑定
15
14
let listener = UnixListener :: bind ( & sock_path) . expect ( "bind failed" ) ;
16
15
17
- // 2. 并发连接
18
16
let tx = thread:: spawn ( move || {
19
17
let mut stream = UnixStream :: connect ( & sock_path) . expect ( "connect failed" ) ;
20
18
stream. write_all ( b"hello" ) . expect ( "write failed" ) ;
21
19
} ) ;
22
20
23
- // 3. 接受
24
21
let ( mut stream, _) = listener. accept ( ) . expect ( "accept failed" ) ;
25
22
let mut buf = [ 0 ; 5 ] ;
26
23
stream. read_exact ( & mut buf) . expect ( "read failed" ) ;
27
24
assert_eq ! ( & buf, b"hello" ) ;
28
25
29
26
tx. join ( ) . unwrap ;
30
27
31
- // 4. 清理
32
28
drop ( listener) ;
33
29
let _ = std:: fs:: remove_file ( & sock_path) ;
34
30
}
You can’t perform that action at this time.
0 commit comments