Skip to content

Commit 1f99139

Browse files
committed
Update
1 parent 5771b98 commit 1f99139

File tree

3 files changed

+5
-6
lines changed

3 files changed

+5
-6
lines changed

src/Servers/Kestrel/Transport.NamedPipes/src/Internal/NamedPipeConnectionListener.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,7 @@ public void Start()
6565
// Start first stream inline to catch creation errors.
6666
var initialStream = CreateServerStream();
6767

68-
_listeningTasks[i] = StartAsync(initialStream, i);
68+
_listeningTasks[i] = Task.Run(() => StartAsync(initialStream, i));
6969
}
7070
}
7171

src/Servers/Kestrel/Transport.NamedPipes/src/NamedPipeTransportOptions.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ public sealed class NamedPipeTransportOptions
1414
/// <summary>
1515
///
1616
/// </summary>
17-
public int AcceptQueueCount { get; set; } = Math.Clamp(Environment.ProcessorCount, 1, 16);
17+
public int AcceptQueueCount { get; set; } = Math.Min(Environment.ProcessorCount, 16);
1818

1919
/// <summary>
2020
/// Gets or sets the maximum unconsumed incoming bytes the transport will buffer.

src/Servers/Kestrel/Transport.NamedPipes/test/NamedPipeConnectionListenerTests.cs

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -77,16 +77,15 @@ public async Task AcceptAsync_ParallelConnections_ClientConnectionsSuccessfullyA
7777

7878
var currentCallCount = 0;
7979
var options = new NamedPipeTransportOptions();
80-
options.AcceptQueueCount = 16;
80+
options.AcceptQueueCount = 1;
8181
await using var connectionListener = await NamedPipeTestHelpers.CreateConnectionListenerFactory(LoggerFactory, options: options);
8282

8383
// Act
8484
var serverTask = Task.Run(async () =>
8585
{
8686
while (currentCallCount < TotalCallCount)
8787
{
88-
var connection = await connectionListener.AcceptAsync().DefaultTimeout();
89-
await connection.DisposeAsync();
88+
_ = await connectionListener.AcceptAsync();
9089

9190
currentCallCount++;
9291

@@ -110,7 +109,7 @@ public async Task AcceptAsync_ParallelConnections_ClientConnectionsSuccessfullyA
110109
await clientStream.ConnectAsync();
111110

112111
await clientStream.WriteAsync(new byte[1]);
113-
await clientStream.ReadAsync(new byte[1]);
112+
await clientStream.DisposeAsync();
114113
clientStreamCount++;
115114
}
116115
catch (IOException ex)

0 commit comments

Comments
 (0)