Skip to content

Commit

Permalink
Fix sync ConnectHelper.Connect (#40880)
Browse files Browse the repository at this point in the history
  • Loading branch information
ManickaP authored Aug 15, 2020
1 parent c00478b commit a32d979
Showing 1 changed file with 3 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,9 @@ public static Connection Connect(string host, int port, CancellationToken cancel
{
socket.Connect(new DnsEndPoint(host, port));
}

// Since we only do GracefulShutdown in SocketsHttpHandler code, Connection.FromStream() should match SocketConnection's behavior:
return Connection.FromStream(new NetworkStream(socket, ownsSocket: true), localEndPoint: socket.LocalEndPoint, remoteEndPoint: socket.RemoteEndPoint);
}
catch (SocketException se)
{
Expand All @@ -77,9 +80,6 @@ public static Connection Connect(string host, int port, CancellationToken cancel
socket.Dispose();
throw CreateWrappedException(e, host, port, cancellationToken);
}

// Since we only do GracefulShutdown in SocketsHttpHandler code, Connection.FromStream() should match SocketConnection's behavior:
return Connection.FromStream(new NetworkStream(socket, ownsSocket: true), localEndPoint: socket.LocalEndPoint, remoteEndPoint: socket.RemoteEndPoint);
}

public static ValueTask<SslStream> EstablishSslConnectionAsync(SslClientAuthenticationOptions sslOptions, HttpRequestMessage request, bool async, Stream stream, CancellationToken cancellationToken)
Expand Down

0 comments on commit a32d979

Please sign in to comment.