File tree Expand file tree Collapse file tree 1 file changed +21
-2
lines changed
projects/RabbitMQ.Client/Impl Expand file tree Collapse file tree 1 file changed +21
-2
lines changed Original file line number Diff line number Diff line change @@ -96,8 +96,27 @@ internal static async ValueTask<AutorecoveringConnection> CreateAsync(Connection
9696 . ConfigureAwait ( false ) ;
9797 Connection innerConnection = new ( config , fh ) ;
9898 AutorecoveringConnection connection = new ( config , endpoints , innerConnection ) ;
99- await innerConnection . OpenAsync ( cancellationToken )
100- . ConfigureAwait ( false ) ;
99+ try
100+ {
101+ await innerConnection . OpenAsync ( cancellationToken )
102+ . ConfigureAwait ( false ) ;
103+ }
104+ catch
105+ {
106+ try
107+ {
108+ await connection . CloseAsync ( cancellationToken )
109+ . ConfigureAwait ( false ) ;
110+ await connection . DisposeAsync ( )
111+ . ConfigureAwait ( false ) ;
112+ }
113+ catch
114+ {
115+ }
116+
117+ throw ;
118+ }
119+
101120 return connection ;
102121 }
103122
You can’t perform that action at this time.
0 commit comments