Skip to content

Commit

Permalink
Move object disposal
Browse files Browse the repository at this point in the history
  • Loading branch information
pglombardo committed Sep 5, 2024
1 parent df6f60f commit 3025cbf
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
4 changes: 4 additions & 0 deletions Source/HiveMQtt/Client/Connection/ConnectionManager.cs
Original file line number Diff line number Diff line change
Expand Up @@ -197,6 +197,10 @@ internal async Task CancelBackgroundTasksAsync()
/// </summary>
public void Dispose()
{
// Dispose managed resources.
this.cancellationTokenSource.Cancel();
this.cancellationTokenSource.Dispose();

this.Dispose();
/*
This object will be cleaned up by the Dispose method.
Expand Down
6 changes: 1 addition & 5 deletions Source/HiveMQtt/Client/HiveMQClientUtil.cs
Original file line number Diff line number Diff line change
Expand Up @@ -173,11 +173,7 @@ protected virtual void Dispose(bool disposing)
Logger.Trace("HiveMQClient Dispose: Disconnecting connected client.");
_ = Task.Run(async () => await this.DisconnectAsync().ConfigureAwait(false));
}

// Dispose managed resources.
// this.cancellationTokenSource.Cancel();
// this.cancellationTokenSource.Dispose();
}
}

Check warning on line 176 in Source/HiveMQtt/Client/HiveMQClientUtil.cs

View workflow job for this annotation

GitHub Actions / pipeline-ubuntu-latest-dotnet-7.0.x

Fix formatting (https://learn.microsoft.com/dotnet/fundamentals/code-analysis/style-rules/ide0055)

Check warning on line 176 in Source/HiveMQtt/Client/HiveMQClientUtil.cs

View workflow job for this annotation

GitHub Actions / pipeline-ubuntu-latest-dotnet-6.0.x

Fix formatting (https://learn.microsoft.com/dotnet/fundamentals/code-analysis/style-rules/ide0055)

Check warning on line 176 in Source/HiveMQtt/Client/HiveMQClientUtil.cs

View workflow job for this annotation

GitHub Actions / pipeline-ubuntu-latest-dotnet-8.0.x

Fix formatting (https://learn.microsoft.com/dotnet/fundamentals/code-analysis/style-rules/ide0055)

Check warning on line 176 in Source/HiveMQtt/Client/HiveMQClientUtil.cs

View workflow job for this annotation

GitHub Actions / pipeline-ubuntu-latest-dotnet-6.0.x

Fix formatting (https://learn.microsoft.com/dotnet/fundamentals/code-analysis/style-rules/ide0055)

Check warning on line 176 in Source/HiveMQtt/Client/HiveMQClientUtil.cs

View workflow job for this annotation

GitHub Actions / pipeline-ubuntu-latest-dotnet-7.0.x

Fix formatting (https://learn.microsoft.com/dotnet/fundamentals/code-analysis/style-rules/ide0055)

Check warning on line 176 in Source/HiveMQtt/Client/HiveMQClientUtil.cs

View workflow job for this annotation

GitHub Actions / pipeline-ubuntu-latest-dotnet-8.0.x

Fix formatting (https://learn.microsoft.com/dotnet/fundamentals/code-analysis/style-rules/ide0055)

// Call the appropriate methods to clean up
// unmanaged resources here.
Expand Down

0 comments on commit 3025cbf

Please sign in to comment.