@@ -15,7 +15,6 @@ use std::thread;
15
15
16
16
#[ cfg( not( any( feature = "force-inprocess" , target_os = "windows" , target_os = "android" ) ) ) ]
17
17
use libc;
18
- #[ cfg( not( any( feature = "force-inprocess" , target_os = "windows" , target_os = "android" ) ) ) ]
19
18
use platform:: { OsIpcSender , OsIpcOneShotServer } ;
20
19
#[ cfg( not( any( feature = "force-inprocess" , target_os = "windows" , target_os = "android" ) ) ) ]
21
20
use test:: { fork, Wait } ;
@@ -396,10 +395,27 @@ fn receiver_set() {
396
395
}
397
396
}
398
397
399
- #[ cfg( not( any( feature = "force-inprocess" , target_os = "windows" , target_os = "android" ) ) ) ]
398
+ #[ cfg( not( any( feature = "force-inprocess" , target_os = "android" ) ) ) ]
399
+ #[ test]
400
+ fn server_accept_first ( ) {
401
+ let ( server, name) = OsIpcOneShotServer :: new ( ) . unwrap ( ) ;
402
+ let data: & [ u8 ] = b"1234567" ;
403
+
404
+ thread:: spawn ( move || {
405
+ thread:: sleep ( Duration :: from_millis ( 30 ) ) ;
406
+ let tx = OsIpcSender :: connect ( name) . unwrap ( ) ;
407
+ tx. send ( data, vec ! [ ] , vec ! [ ] ) . unwrap ( ) ;
408
+ } ) ;
409
+
410
+ let ( _, mut received_data, received_channels, received_shared_memory_regions) =
411
+ server. accept ( ) . unwrap ( ) ;
412
+ received_data. truncate ( 7 ) ;
413
+ assert_eq ! ( ( & received_data[ ..] , received_channels, received_shared_memory_regions) ,
414
+ ( data, vec![ ] , vec![ ] ) ) ;
415
+ }
416
+
400
417
#[ test]
401
- //XXXjdm This hangs indefinitely with inprocess impl and warrants further investigation.
402
- fn server ( ) {
418
+ fn server_connect_first ( ) {
403
419
let ( server, name) = OsIpcOneShotServer :: new ( ) . unwrap ( ) ;
404
420
let data: & [ u8 ] = b"1234567" ;
405
421
@@ -408,6 +424,7 @@ fn server() {
408
424
tx. send ( data, vec ! [ ] , vec ! [ ] ) . unwrap ( ) ;
409
425
} ) ;
410
426
427
+ thread:: sleep ( Duration :: from_millis ( 30 ) ) ;
411
428
let ( _, mut received_data, received_channels, received_shared_memory_regions) =
412
429
server. accept ( ) . unwrap ( ) ;
413
430
received_data. truncate ( 7 ) ;
0 commit comments