The only downloader you need. 下载器的集大成者。
TypeScript asyncasynciobittorentbtcross-platformdownload-managerdownloaderfluent-designftphttp3magnetpyqtpyside6pythonqtquicreactsoftwarestreaming
fix(ed2k): close 不再走 _request,消除子进程退出竞态
XiaoYouChR0097b2ec4eeb
diff --git a/features/ed2k_pack/python_ed2k/client.py b/features/ed2k_pack/python_ed2k/client.pyindex 6e162e9b..6e04a475 100644--- a/features/ed2k_pack/python_ed2k/client.py+++ b/features/ed2k_pack/python_ed2k/client.py@@ -124,8 +124,27 @@ class Client:if process is None or process.returncode is not None:returnself._closing = True- await self._request("close")- await process.wait()+ if process.stdin is not None and self._writeLock is not None:+ requestId = self._nextId+ self._nextId += 1+ message = json.dumps(+ {"version": RPC_VERSION, "id": requestId, "method": "close", "params": {}},+ separators=(",", ":"),+ ).encode() + b"\n"+ try:+ async with self._writeLock:+ process.stdin.write(message)+ await process.stdin.drain()+ except (BrokenPipeError, ConnectionResetError):+ pass+ try:+ await asyncio.wait_for(process.wait(), timeout=15)+ except asyncio.TimeoutError:+ try:+ process.kill()+ except ProcessLookupError:+ pass+ await process.wait()await self._setStopped(process)if self._process is process:self._process = Nonediff --git a/features/ed2k_pack/session.py b/features/ed2k_pack/session.pyindex 89a525e3..aab7d246 100644--- a/features/ed2k_pack/session.py+++ b/features/ed2k_pack/session.py@@ -51,10 +51,7 @@ class ED2kSession:async def close(self) -> None:if self._client is None:return- try:- await self._client.close()- except Exception as e:- logger.opt(exception=e).warning("关闭 goed2kd 失败")+ await self._client.close()self._client = None