Dispose WebSocket if StartAsync fails (#3311)
This commit is contained in:
parent
3db604d9d2
commit
4cbabea501
|
|
@ -119,7 +119,15 @@ namespace Microsoft.AspNetCore.Http.Connections.Client.Internal
|
|||
|
||||
Log.StartTransport(_logger, transferFormat, resolvedUrl);
|
||||
|
||||
await _webSocket.ConnectAsync(resolvedUrl, CancellationToken.None);
|
||||
try
|
||||
{
|
||||
await _webSocket.ConnectAsync(resolvedUrl, CancellationToken.None);
|
||||
}
|
||||
catch
|
||||
{
|
||||
_webSocket.Dispose();
|
||||
throw;
|
||||
}
|
||||
|
||||
Log.StartedTransport(_logger);
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue