Skip to content

Commit 80b76d7

Browse files
committed
Fix not releasing connection on timeout (#1071).
1 parent 427c3e0 commit 80b76d7

File tree

1 file changed

+18
-12
lines changed

1 file changed

+18
-12
lines changed

src/FirebirdSql.Data.FirebirdClient/FirebirdClient/FbConnection.cs

Lines changed: 18 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -585,12 +585,15 @@ public override void Open()
585585
{
586586
try
587587
{
588-
_innerConnection.Connect();
589-
}
590-
catch (OperationCanceledException ex)
591-
{
592-
//cancellationToken.ThrowIfCancellationRequested();
593-
throw new TimeoutException("Timeout while connecting.", ex);
588+
try
589+
{
590+
_innerConnection.Connect();
591+
}
592+
catch (OperationCanceledException ex)
593+
{
594+
//cancellationToken.ThrowIfCancellationRequested();
595+
throw new TimeoutException("Timeout while connecting.", ex);
596+
}
594597
}
595598
catch
596599
{
@@ -678,12 +681,15 @@ public override async Task OpenAsync(CancellationToken cancellationToken)
678681
{
679682
try
680683
{
681-
await _innerConnection.ConnectAsync(cancellationToken).ConfigureAwait(false);
682-
}
683-
catch (OperationCanceledException ex)
684-
{
685-
cancellationToken.ThrowIfCancellationRequested();
686-
throw new TimeoutException("Timeout while connecting.", ex);
684+
try
685+
{
686+
await _innerConnection.ConnectAsync(cancellationToken).ConfigureAwait(false);
687+
}
688+
catch (OperationCanceledException ex)
689+
{
690+
cancellationToken.ThrowIfCancellationRequested();
691+
throw new TimeoutException("Timeout while connecting.", ex);
692+
}
687693
}
688694
catch
689695
{

0 commit comments

Comments
 (0)