@@ -40,28 +40,35 @@ public async Task PipeSecurityForWindows()
40
40
await CreateSystemService ( ) . DoNothing ( ) . ShouldThrowAsync < UnauthorizedAccessException > ( ) ;
41
41
}
42
42
43
- [ Fact ]
44
- public async Task PipeCancelIoOnServer_TwiceTightly ( )
45
- {
46
- //Two cancel with less than 1 second in between should fail
47
- await _systemClient . CancelIoPipe ( new ( 100 ) ) . ShouldThrowAsync < IOException > ( ) ;
48
- }
43
+ [ Theory ]
44
+ [ InlineData ( new int [ 0 ] ) ]
45
+ [ InlineData ( 100 ) ]
46
+ [ InlineData ( 1100 ) ]
47
+ [ InlineData ( 10 , 10 , 10 , 10 ) ]
48
+ public async Task PipeCancelIoOnServer_AnyNoOfTimes ( params int [ ] msDelays )
49
+ {
50
+ // Any number of kernel32.CancelIoEx calls should not cause the client to give up on the connection.
51
+ ( await _systemClient . CancelIoPipe ( new ( ) { MsDelays = msDelays } ) ) . ShouldBeTrue ( ) ;
49
52
50
- [ Fact ]
51
- public async Task PipeCancelIoOnClient ( )
52
- {
53
- ( await _systemClient . Delay ( ) ) . ShouldBeTrue ( ) ;
53
+ //Make sure the connection is still working
54
+ ( await _systemClient . Delay ( ) ) . ShouldBeTrue ( ) ;
55
+ }
54
56
55
- var delayTask = _systemClient . Delay ( 500 ) ;
56
- await Task . Delay ( 100 ) ;
57
- var pipeStream = ( ( IpcProxy ) _systemClient ) . Connection . Network as PipeStream ;
58
- SystemService . CancelIoEx ( pipeStream . SafePipeHandle . DangerousGetHandle ( ) , IntPtr . Zero ) . ShouldBeTrue ( ) ;
57
+ [ Fact ]
58
+ public async Task PipeCancelIoOnClient ( )
59
+ {
60
+ ( await _systemClient . Delay ( ) ) . ShouldBeTrue ( ) ;
61
+
62
+ var delayTask = _systemClient . Delay ( 500 ) ;
63
+ await Task . Delay ( 100 ) ;
64
+ var pipeStream = ( ( IpcProxy ) _systemClient ) . Connection . Network as PipeStream ;
65
+ SystemService . CancelIoEx ( pipeStream . SafePipeHandle . DangerousGetHandle ( ) , IntPtr . Zero ) . ShouldBeTrue ( ) ;
59
66
60
- ( await delayTask ) . ShouldBeTrue ( ) ;
67
+ ( await delayTask ) . ShouldBeTrue ( ) ;
61
68
62
- //Make sure the connection is still working
63
- ( await _systemClient . Delay ( ) ) . ShouldBeTrue ( ) ;
64
- }
69
+ //Make sure the connection is still working
70
+ ( await _systemClient . Delay ( ) ) . ShouldBeTrue ( ) ;
71
+ }
65
72
#endif
66
73
}
67
74
public class ComputingNamedPipeTests : ComputingTests < NamedPipeClientBuilder < IComputingService , IComputingCallback > >
0 commit comments