@@ -57,7 +57,8 @@ fn unix_stream_connect() {
5757
5858 let barrier_clone = barrier. clone ( ) ;
5959 let handle = thread:: spawn ( move || {
60- let ( stream, _) = listener. accept ( ) . unwrap ( ) ;
60+ let ( mut stream, _) = listener. accept ( ) . unwrap ( ) ;
61+ stream. write_all ( b"Hi" ) . unwrap ( ) ;
6162 barrier_clone. wait ( ) ;
6263 drop ( stream) ;
6364 } ) ;
@@ -76,12 +77,18 @@ fn unix_stream_connect() {
7677 ) ;
7778
7879 barrier. wait ( ) ;
80+ #[ cfg( unix) ]
7981 expect_events (
8082 & mut poll,
8183 & mut events,
8284 vec ! [ ExpectEvent :: new( TOKEN_1 , Interest :: READABLE ) ] ,
8385 ) ;
84-
86+ #[ cfg( windows) ]
87+ {
88+ let mut buf = [ 0 ; 2 ] ;
89+ assert_eq ! ( stream. read( & mut buf) . unwrap( ) , 2 ) ;
90+ assert_eq ! ( buf, * b"Hi" ) ;
91+ }
8592 handle. join ( ) . unwrap ( ) ;
8693}
8794
@@ -198,9 +205,9 @@ fn unix_stream_pair() {
198205fn unix_stream_peer_addr ( ) {
199206 init ( ) ;
200207 let ( handle, expected_addr) = new_echo_listener ( 1 , "unix_stream_peer_addr" ) ;
201- let expected_path = expected_addr. as_pathname ( ) . expect ( "failed to get pathname" ) ;
208+ let path = expected_addr. as_pathname ( ) . expect ( "failed to get pathname" ) ;
202209
203- let stream = UnixStream :: connect ( expected_path ) . unwrap ( ) ;
210+ let stream = UnixStream :: connect ( path ) . unwrap ( ) ;
204211 // Complete handshake to unblock the server thread.
205212 #[ cfg( target_os = "cygwin" ) ]
206213 let stream = {
@@ -221,14 +228,13 @@ fn unix_stream_peer_addr() {
221228 stream
222229 } ;
223230
224- assert_eq ! (
225- stream. peer_addr( ) . unwrap( ) . as_pathname( ) . unwrap( ) ,
226- expected_path
227- ) ;
231+ assert_eq ! ( stream. peer_addr( ) . unwrap( ) . as_pathname( ) . unwrap( ) , path) ;
228232 assert ! ( stream. local_addr( ) . unwrap( ) . as_pathname( ) . is_none( ) ) ;
229233
230234 // Close the connection to allow the remote to shutdown
231235 drop ( stream) ;
236+ std:: fs:: remove_file ( path) . unwrap ( ) ;
237+
232238 handle. join ( ) . unwrap ( ) ;
233239}
234240
@@ -290,6 +296,7 @@ fn unix_stream_shutdown_read() {
290296
291297 // Close the connection to allow the remote to shutdown
292298 drop ( stream) ;
299+ std:: fs:: remove_file ( path) . unwrap ( ) ;
293300 handle. join ( ) . unwrap ( ) ;
294301}
295302
@@ -352,6 +359,8 @@ fn unix_stream_shutdown_write() {
352359
353360 // Close the connection to allow the remote to shutdown
354361 drop ( stream) ;
362+ std:: fs:: remove_file ( path) . unwrap ( ) ;
363+
355364 handle. join ( ) . unwrap ( ) ;
356365}
357366
@@ -421,6 +430,8 @@ fn unix_stream_shutdown_both() {
421430
422431 // Close the connection to allow the remote to shutdown
423432 drop ( stream) ;
433+ std:: fs:: remove_file ( path) . unwrap ( ) ;
434+
424435 handle. join ( ) . unwrap ( ) ;
425436}
426437
@@ -458,6 +469,8 @@ fn unix_stream_shutdown_listener_write() {
458469 ) ;
459470
460471 barrier. wait ( ) ;
472+ std:: fs:: remove_file ( path) . unwrap ( ) ;
473+
461474 handle. join ( ) . unwrap ( ) ;
462475}
463476
@@ -479,6 +492,8 @@ fn unix_stream_register() {
479492
480493 // Close the connection to allow the remote to shutdown
481494 drop ( stream) ;
495+ std:: fs:: remove_file ( path) . unwrap ( ) ;
496+
482497 handle. join ( ) . unwrap ( ) ;
483498}
484499
@@ -507,6 +522,8 @@ fn unix_stream_reregister() {
507522
508523 // Close the connection to allow the remote to shutdown
509524 drop ( stream) ;
525+ std:: fs:: remove_file ( path) . unwrap ( ) ;
526+
510527 handle. join ( ) . unwrap ( ) ;
511528}
512529
@@ -547,6 +564,8 @@ fn unix_stream_deregister() {
547564
548565 // Close the connection to allow the remote to shutdown
549566 drop ( stream) ;
567+ std:: fs:: remove_file ( path) . unwrap ( ) ;
568+
550569 handle. join ( ) . unwrap ( ) ;
551570}
552571
0 commit comments