Skip to content

Comments

feat: 新的下载器#2461

Open
whitecat346 wants to merge 3 commits intoPCL-Community:devfrom
whitecat346:feat/ndl
Open

feat: 新的下载器#2461
whitecat346 wants to merge 3 commits intoPCL-Community:devfrom
whitecat346:feat/ndl

Conversation

@whitecat346
Copy link
Member

普普通通的下载器。
因为过于久远,我忘了要求,如果哪里不好提个review。
使用方法见PCL.Core.Test.Downloader.RealFileDownloadTests.DownloadFile_ShouldCompleteSuccessfully()

@whitecat346 whitecat346 self-assigned this Feb 21, 2026
@pcl-ce-automation pcl-ce-automation bot added 🛠️ 等待审查 Pull Request 已完善,等待维护者或负责人进行代码审查 size: XXL PR 大小评估:巨型 labels Feb 21, 2026
@ruattd
Copy link
Contributor

ruattd commented Feb 21, 2026

建议你同步一下上游,现在上游的目录结构有比较大的改变

# Conflicts:
#	PCL.Core/IO/Download/IDlConnection.cs
#	PCL.Core/IO/Download/IDlResourceMapping.cs
#	PCL.Core/IO/Download/IDlWriter.cs
#	PCL.Core/IO/Download/NDlFactory.cs
#	PCL.Core/Net/NDownload/IDlConnection.cs
#	PCL.Core/Net/NDownload/IDlResourceMapping.cs
#	PCL.Core/Net/NDownload/IDlWriter.cs
#	PCL.Core/Net/NDownload/Interfaces/IDlConnection.cs
#	PCL.Core/Net/NDownload/Interfaces/IDlResourceMapping.cs
#	PCL.Core/Net/NDownload/Interfaces/IDlWriter.cs
@whitecat346
Copy link
Member Author

建议你同步一下上游,现在上游的目录结构有比较大的改变

done

@ruattd ruattd self-requested a review February 21, 2026 11:52
Copy link
Member

@SALTWOOD SALTWOOD left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

一般

{
public required string Url { get; init; }
public bool IsAlive { get; set; } = true;
public long LatencyMs { get; set; }
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

这里的 LatencyMs 也许可以换个名字?LatencyMilliseconds 个人感觉比较好些

Suggested change
public long LatencyMs { get; set; }
public long LatencyMilliseconds { get; set; }

Copy link
Contributor

@ruattd ruattd left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

存在几个问题:

  1. 应该存在一个全局共用的线程数限制
  2. 应当支持处理多个文件和多次提交,并复用已有的 DownloadClient 实例,一个下载任务很可能包含一大批文件且可能先后多次提交,它们要与已存在的所有任务共享全局线程数限制,在有必要的时候需要排队机制
  3. HttpClient 应使用传入 getter delegate 的方式获取,每次下载均创建一个 HttpClient 会导致大量小文件下载时初始化时长远大于实际数据传输时长,极其影响性能
  4. 需要支持持久化 mirror 数据,因为一个 mirror 的质量在一个用户那里大概率是一直相同的,每次都收集数据并动态决策本身就是很耗时的操作了(因此也引出了新的问题:需要考虑更复杂更全面的 mirror 评估算法)
  5. 测试明显像 AI 写的,代码的 AI 参与度比较存疑,这点需要一个明确解释

Comment on lines +13 to +14

namespace PCL.Core.Net.Downloader;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

命名空间与目录不一致,低级问题,大概看了下所有 Download 目录里的文件都有这个问题

Comment on lines 1 to 13
@@ -8,9 +11,6 @@
using System.Text.Json;
using System.Threading;
using System.Threading.Tasks;
using PCL.Core.App;
using PCL.Core.Logging;
using PCL.Core.Utils.Exts;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

莫名其妙的更改

@whitecat346
Copy link
Member Author

  1. 测试明显像 AI 写的,代码的 AI 参与度比较存疑,这点需要一个明确解释

测试懒得写,直接丢给AI让他写了(

并复用已有的 DownloadClient 实例

这个PR只是一个底层的部分,我计划把这个作为上层部分来实现(DownloadManager)

需要考虑更复杂更全面的 mirror 评估算法

我实在想不出来,请大神来co-auther

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

size: XXL PR 大小评估:巨型 🛠️ 等待审查 Pull Request 已完善,等待维护者或负责人进行代码审查

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants