|
1 | 1 | // Licensed to the .NET Foundation under one or more agreements. |
2 | 2 | // The .NET Foundation licenses this file to you under the MIT license. |
3 | 3 |
|
| 4 | +#nullable enable |
| 5 | + |
4 | 6 | internal sealed class SizeLimitedStream : Stream |
5 | 7 | { |
6 | 8 | private readonly Stream _innerStream; |
7 | 9 | private readonly long? _sizeLimit; |
8 | | - private readonly Action<long, long>? _handleSizeLimit; |
| 10 | + private readonly Action<long>? _handleSizeLimit; |
9 | 11 | private long _totalBytesRead; |
10 | 12 |
|
11 | | - public SizeLimitedStream(Stream innerStream, long? sizeLimit, Action<long, long>? handleSizeLimit = null) |
| 13 | + public SizeLimitedStream(Stream innerStream, long? sizeLimit, Action<long>? handleSizeLimit = null) |
12 | 14 | { |
13 | 15 | ArgumentNullException.ThrowIfNull(innerStream); |
14 | 16 |
|
@@ -51,7 +53,7 @@ public override int Read(byte[] buffer, int offset, int count) |
51 | 53 | { |
52 | 54 | if (_handleSizeLimit != null) |
53 | 55 | { |
54 | | - _handleSizeLimit(_totalBytesRead, _sizeLimit.Value); |
| 56 | + _handleSizeLimit(_sizeLimit.Value); |
55 | 57 | } |
56 | 58 | else |
57 | 59 | { |
@@ -91,7 +93,7 @@ public override async ValueTask<int> ReadAsync(Memory<byte> buffer, Cancellation |
91 | 93 | { |
92 | 94 | if (_handleSizeLimit != null) |
93 | 95 | { |
94 | | - _handleSizeLimit(_totalBytesRead, _sizeLimit.Value); |
| 96 | + _handleSizeLimit(_sizeLimit.Value); |
95 | 97 | } |
96 | 98 | else |
97 | 99 | { |
|
0 commit comments