Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix the IOCP count config var test #106408

Merged
merged 2 commits into from
Aug 14, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -1394,15 +1394,14 @@ static async Task RunAsyncIOTest()
var done = new AutoResetEvent(false);

// Receiver
var receiveBuffer = new byte[1];
using var listener = new TcpListener(IPAddress.Loopback, 0);
listener.Start();
var t = ThreadTestHelpers.CreateGuardedThread(
out Action checkForThreadErrors,
out Action waitForThread,
async () =>
{
using var listener = new TcpListener(IPAddress.Loopback, 55555);
var receiveBuffer = new byte[1];
listener.Start();
done.Set(); // indicate listener started
while (true)
{
// Accept a connection, receive a byte
Expand All @@ -1415,15 +1414,14 @@ static async Task RunAsyncIOTest()
});
t.IsBackground = true;
t.Start();
done.CheckedWait(); // wait for listener to start

// Sender
var sendBuffer = new byte[1];
for (int i = 0; i < PretendProcessorCount / 2; i++)
{
// Connect, send a byte
using var client = new TcpClient();
await client.ConnectAsync(IPAddress.Loopback, 55555);
await client.ConnectAsync((IPEndPoint)listener.LocalEndpoint);
int bytesSent =
await client.Client.SendAsync(new ArraySegment<byte>(sendBuffer), SocketFlags.None);
Assert.Equal(1, bytesSent);
Expand Down
Loading