@@ -23,7 +23,6 @@ use std::os::windows::ffi::OsStrExt;
2323use std:: os:: windows:: fs:: OpenOptionsExt ;
2424use std:: os:: windows:: io:: { IntoRawHandle } ;
2525use std:: sync:: atomic:: { AtomicBool , Ordering } ;
26- use std:: sync:: { Arc } ;
2726use std:: { io} ;
2827
2928use windows_sys:: Win32 :: Foundation :: { CloseHandle , ERROR_IO_PENDING , ERROR_PIPE_CONNECTED , INVALID_HANDLE_VALUE } ;
@@ -75,14 +74,7 @@ impl PipeListener {
7574 // accept returns:
7675 // - Ok(Some(PipeConnection)) if a new connection is established
7776 // - Err(io::Error) if there is an error and listener loop should be shutdown
78- pub ( crate ) fn accept ( & self , quit_flag : & Arc < AtomicBool > ) -> std:: result:: Result < Option < PipeConnection > , io:: Error > {
79- if quit_flag. load ( Ordering :: SeqCst ) {
80- return Err ( io:: Error :: new (
81- io:: ErrorKind :: Other ,
82- "listener shutdown for quit flag" ,
83- ) ) ;
84- }
85-
77+ pub ( crate ) fn accept ( & self ) -> std:: result:: Result < Option < PipeConnection > , io:: Error > {
8678 // Create a new pipe instance for every new client
8779 let instance = self . new_instance ( ) ?;
8880 let np = match PipeConnection :: new ( instance) {
@@ -376,6 +368,7 @@ fn handle_windows_error(e: io::Error) -> Error {
376368#[ cfg( test) ]
377369mod test {
378370 use super :: * ;
371+ use std:: sync:: Arc ;
379372 use windows_sys:: Win32 :: Foundation :: ERROR_FILE_NOT_FOUND ;
380373
381374 #[ test]
@@ -398,8 +391,7 @@ mod test {
398391
399392 let listener_server = listener. clone ( ) ;
400393 let thread = std:: thread:: spawn ( move || {
401- let quit_flag = Arc :: new ( AtomicBool :: new ( false ) ) ;
402- match listener_server. accept ( & quit_flag) {
394+ match listener_server. accept ( ) {
403395 Ok ( Some ( _) ) => {
404396 // pipe is working
405397 }
@@ -422,8 +414,7 @@ mod test {
422414
423415 let listener_server = listener. clone ( ) ;
424416 let thread = std:: thread:: spawn ( move || {
425- let quit_flag = Arc :: new ( AtomicBool :: new ( false ) ) ;
426- match listener_server. accept ( & quit_flag) {
417+ match listener_server. accept ( ) {
427418 Ok ( _) => {
428419 panic ! ( "should not get pipe on close" )
429420 }
0 commit comments