From 094ee57c4cf687dacb8f66eb7e97f2b2faf61f6a Mon Sep 17 00:00:00 2001 From: Martin Baulig Date: Wed, 8 Jan 2020 17:31:39 -0500 Subject: [Sockets]: Always reset internal SAEA completion when reattempting connection in MultipleConnectAsync. This should fix #18030. --- .../src/System/Net/Sockets/MultipleConnectAsync.cs | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/src/System.Net.Sockets/src/System/Net/Sockets/MultipleConnectAsync.cs b/src/System.Net.Sockets/src/System/Net/Sockets/MultipleConnectAsync.cs index 5a3d9f897e..c9c5afa7d0 100644 --- a/src/System.Net.Sockets/src/System/Net/Sockets/MultipleConnectAsync.cs +++ b/src/System.Net.Sockets/src/System/Net/Sockets/MultipleConnectAsync.cs @@ -187,6 +187,15 @@ namespace System.Net.Sockets // Keep track of this because it will be overwritten by AttemptConnection SocketError currentFailure = args.SocketError; +#if MONO + // Make sure we're always resetting the Mono-specific `in_progress` field when + // re-attempting a connection. + // If a previous connection failed asynchronously, then it will already have been + // resetted, but not on synchronous connection failures (such as for instance, the + // host not supporting IPv6 or the network being down). + // This should fix https://github.com/mono/mono/issues/18030. + args.in_progress = 0; +#endif Exception connectException = AttemptConnection(); if (connectException == null) -- cgit v1.2.3