Skip to content

Commit f90b9ca

Browse files
Manually backport #1206
1 parent 1b94cb2 commit f90b9ca

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

projects/RabbitMQ.Client/client/impl/SocketFrameHandler.cs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,9 @@ internal static class TaskExtensions
4848
{
4949
public static async Task TimeoutAfter(this Task task, TimeSpan timeout)
5050
{
51+
#if NET6_0_OR_GREATER
52+
await task.WaitAsync(timeout).ConfigureAwait(false);
53+
#else
5154
if (task == await Task.WhenAny(task, Task.Delay(timeout)).ConfigureAwait(false))
5255
{
5356
await task;
@@ -57,6 +60,7 @@ public static async Task TimeoutAfter(this Task task, TimeSpan timeout)
5760
Task supressErrorTask = task.ContinueWith(t => t.Exception.Handle(e => true), TaskContinuationOptions.OnlyOnFaulted);
5861
throw new TimeoutException();
5962
}
63+
#endif
6064
}
6165
}
6266

0 commit comments

Comments
 (0)