mirror of
https://github.com/JustArchiNET/ArchiSteamFarm.git
synced 2026-01-16 08:25:28 +00:00
Use recommended async dispose pattern
Funny enough, non-breaking API changes since all of those classes are sealed.
This commit is contained in:
@@ -27,7 +27,7 @@ using JetBrains.Annotations;
|
||||
|
||||
namespace ArchiSteamFarm.Web.Responses;
|
||||
|
||||
public sealed class StreamResponse : BasicResponse, IAsyncDisposable {
|
||||
public sealed class StreamResponse : BasicResponse, IAsyncDisposable, IDisposable {
|
||||
[PublicAPI]
|
||||
public Stream? Content { get; }
|
||||
|
||||
@@ -43,6 +43,11 @@ public sealed class StreamResponse : BasicResponse, IAsyncDisposable {
|
||||
Length = httpResponseMessage.Content.Headers.ContentLength.GetValueOrDefault();
|
||||
}
|
||||
|
||||
public void Dispose() {
|
||||
Content?.Dispose();
|
||||
ResponseMessage.Dispose();
|
||||
}
|
||||
|
||||
public async ValueTask DisposeAsync() {
|
||||
if (Content != null) {
|
||||
await Content.DisposeAsync().ConfigureAwait(false);
|
||||
|
||||
Reference in New Issue
Block a user