Skip to content

Commit 89278a7

Browse files
committed
修改命名
1 parent 1ce4868 commit 89278a7

1 file changed

Lines changed: 11 additions & 11 deletions

File tree

src/dotnetCampus.FileDownloader/DownloadByHttpClient/SegmentFileDownloaderByHttpClient.cs

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@ public SegmentFileDownloaderByHttpClient(string url, FileInfo file,
6262
_shouldDisposeHttpClient = httpClient is null;
6363
HttpClient = httpClient ?? CreateDefaultHttpClient();
6464

65-
DownloadDataList = Channel.CreateUnbounded<DownloadData>(new UnboundedChannelOptions()
65+
DownloadDataChannel = Channel.CreateUnbounded<DownloadData>(new UnboundedChannelOptions()
6666
{
6767
SingleReader = false,
6868
AllowSynchronousContinuations = true,
@@ -170,12 +170,12 @@ private static SocketsHttpHandler CreateDefaultSocketsHttpHandler()
170170
/// </summary>
171171
public string Url { get; }
172172

173-
private Channel<DownloadData> DownloadDataList { get; }
173+
private Channel<DownloadData> DownloadDataChannel { get; }
174174

175175
/// <summary>
176-
/// 被加入到 <see cref="DownloadDataList"/> 的下载数量
176+
/// 被加入到 <see cref="DownloadDataChannel"/> 的下载数量
177177
/// </summary>
178-
private int _workTaskCount;
178+
private int _workingTaskCount;
179179

180180
/// <summary>
181181
/// 下载的文件
@@ -240,7 +240,7 @@ private async void ControlSwitch()
240240
{
241241
LogDebugInternal("Start ControlSwitch");
242242
var (segment, runCount, maxReportTime) = SegmentManager.GetMaxWaitReportTimeDownloadSegmentStatus();
243-
var waitCount = _workTaskCount;
243+
var waitCount = _workingTaskCount;
244244

245245
LogDebugInternal("ControlSwitch 当前等待数量:{0},待命最大响应时间:{1},运行数量:{2},运行线程{3}", waitCount, maxReportTime, runCount, _threadCount);
246246

@@ -566,20 +566,20 @@ private async ValueTask DownloadTask()
566566
DownloadData data;
567567
try
568568
{
569-
var canRead = await DownloadDataList.Reader.WaitToReadAsync();
569+
var canRead = await DownloadDataChannel.Reader.WaitToReadAsync();
570570
if (!canRead)
571571
{
572572
// 不能读取了,那就返回吧
573573
return;
574574
}
575575

576-
if (!DownloadDataList.Reader.TryRead(out data))
576+
if (!DownloadDataChannel.Reader.TryRead(out data))
577577
{
578578
// 居然读取不到数据,那就再次进入循环吧
579579
continue;
580580
}
581581

582-
Interlocked.Decrement(ref _workTaskCount);
582+
Interlocked.Decrement(ref _workingTaskCount);
583583
}
584584
catch (ChannelClosedException)
585585
{
@@ -724,8 +724,8 @@ private void LogDownloadSegment(DownloadSegment downloadSegment)
724724
private async void Download(HttpResponseMessage? httpResponseMessage, DownloadSegment downloadSegment)
725725
{
726726
LogDebugInternal("[Download] Enqueue Download. {0}", downloadSegment);
727-
await DownloadDataList.Writer.WriteAsync(new DownloadData(httpResponseMessage, downloadSegment)).ConfigureAwait(false);
728-
Interlocked.Increment(ref _workTaskCount);
727+
await DownloadDataChannel.Writer.WriteAsync(new DownloadData(httpResponseMessage, downloadSegment)).ConfigureAwait(false);
728+
Interlocked.Increment(ref _workingTaskCount);
729729
}
730730

731731
private void Download(DownloadSegment? downloadSegment)
@@ -760,7 +760,7 @@ private async ValueTask FinishDownload()
760760
await FileWriter.DisposeAsync().ConfigureAwait(false);
761761
await FileStream.DisposeAsync().ConfigureAwait(false);
762762

763-
DownloadDataList.Writer.Complete();
763+
DownloadDataChannel.Writer.Complete();
764764

765765
BreakpointResumptionTransmissionManager?.Dispose();
766766
// 默认下载完成删除断点续传文件

0 commit comments

Comments
 (0)