Skip to content
Closed
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 @@ -563,7 +563,8 @@ private static async void ParallelConnectHelper(
{
// Try to connect. If we're successful, store this task into the result task.
await connectTask.ConfigureAwait(false);
success = tcs.TrySetResult(socket);
// A connection attempt could return quickly if a server refuses connection or there is some other error
success = socket.Connected && tcs.TrySetResult(socket);
if (success)
{
// Whichever connection completes the return task is responsible for disposing
Expand Down
Loading