Skip to content

Commit 1d7da2d

Browse files
author
Hubert Plociniczak
committed
Use Abort rather than Close to avoid AlreadyClosedException.
Go through the shutdown errors list and throw the first one with exception included (if any). This is to notify the user that some unusual exception has actually happened, but only after attempting to close the connection.
1 parent a24af6e commit 1d7da2d

File tree

1 file changed

+11
-1
lines changed

1 file changed

+11
-1
lines changed

src/client/impl/ConnectionBase.cs

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -334,7 +334,17 @@ public IList ShutdownReport
334334

335335
void IDisposable.Dispose()
336336
{
337-
Close();
337+
Abort();
338+
if (ShutdownReport.Count > 0)
339+
{
340+
foreach (ShutdownReportEntry entry in ShutdownReport)
341+
{
342+
if (entry.Exception != null)
343+
throw entry.Exception;
344+
}
345+
346+
throw new OperationInterruptedException(null);
347+
}
338348
}
339349

340350
///<summary>API-side invocation of connection close.</summary>

0 commit comments

Comments
 (0)