From: Eirik Tsarpalis Date: Tue, 17 Dec 2019 19:17:51 +0000 (+0200) Subject: SslStress: add randomized delays (#977) X-Git-Tag: submit/tizen/20210909.063632~10658 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=416ef2aa2f71565fa19697aa41f9e0d0e5f83066;p=platform%2Fupstream%2Fdotnet%2Fruntime.git SslStress: add randomized delays (#977) --- diff --git a/src/libraries/System.Net.Security/tests/StressTests/SslStress/StressOperations.cs b/src/libraries/System.Net.Security/tests/StressTests/SslStress/StressOperations.cs index 394f3fd..cefbb5e 100644 --- a/src/libraries/System.Net.Security/tests/StressTests/SslStress/StressOperations.cs +++ b/src/libraries/System.Net.Security/tests/StressTests/SslStress/StressOperations.cs @@ -121,6 +121,19 @@ namespace SslStress { await stream.FlushAsync(token); } + + // randomized delay + if (random.NextBoolean(probability: 0.05)) + { + if (random.NextBoolean(probability: 0.7)) + { + await Task.Delay(random.Next(60)); + } + else + { + Thread.SpinWait(random.Next(1000)); + } + } } }