Skip to content

Commit

Permalink
fix: 下载移除dht文件
Browse files Browse the repository at this point in the history
下载移除dht文件

Task: https://pms.uniontech.com/task-view-368187.html
Log: 下载移除dht文件
  • Loading branch information
myk1343 authored and deepin-bot[bot] committed Nov 25, 2024
1 parent 51cdf21 commit f720cab
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 18 deletions.
11 changes: 2 additions & 9 deletions src/src/aria2/aria2rpcinterface.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -108,15 +108,10 @@ bool Aria2RPCInterface::startUp()
*设置aria2c session 路径 时间 input 路径
*/
QString sessionCacheFile = QDir::homePath() + "/.cache/uos-aria2c.session"; //session 文件路径
QString inputFile = QDir::homePath() + "/.cache/uos-aria2c.input"; //.input文件路径
QString dhtFile = QDir::homePath() + "/.config/uos/downloader/dht.dat"; //
QString dht6File = QDir::homePath() + "/.config/uos/downloader/dht6.dat"; //
QString saveSessionInterval = "30"; //

qDebug() << "创建session缓存文件: " << sessionCacheFile;
QProcess::execute("touch", QStringList() << sessionCacheFile); //创建session缓存文件
//QProcess::execute("touch", QStringList() << dhtFile); //创建dht文件
//QProcess::execute("touch", QStringList() << dht6File); //创建dht6文件

QString opt;
opt += " --enable-rpc=true"; //启动RPC
Expand Down Expand Up @@ -147,8 +142,6 @@ bool Aria2RPCInterface::startUp()
opt += " --save-session-interval=" + saveSessionInterval;
opt += " --enable-dht=true"; //启动dht文件
opt += " --enable-dht6=false"; //禁用dht6文件
opt += " --dht-file-path=" + dhtFile;
opt += " --dht-file-path6=" + dht6File;
opt += " --follow-metalink=false";
if(QSysInfo::currentCpuArchitecture() == "loongarch64"){
opt += " --async-dns=false";
Expand Down Expand Up @@ -806,8 +799,8 @@ long Aria2RPCInterface::getCapacityFreeByte(QString path)
{
QProcess *proc = new QProcess;
QStringList opt;
opt << "df " + path;
proc->start("/bin/bash", opt);
opt << path;
proc->start("df", opt);
proc->waitForFinished();
QByteArray rt = proc->readAllStandardOutput();
proc->close();
Expand Down
9 changes: 0 additions & 9 deletions src/src/ui/mainFrame/mainframe.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -414,15 +414,6 @@ void MainFrame::updateDHTFile()
}
QFile::remove(QDir::homePath() + "/.config/uos/downloader/dht.dat");
QFile::remove(QDir::homePath() + "/.config/uos/downloader/dht6.dat");

QString dhtpah = QDir::homePath() + "/.config/uos/downloader/";
static QProcess p;
p.start("curl --connect-timeout 10 -m 20 https://github.com/P3TERX/aria2.conf/raw/master/dht6.dat -o" + dhtpah + "dht6.dat -O");
p.setStandardOutputFile("/dev/null");

static QProcess p2;
p2.start("curl --connect-timeout 10 -m 20 https://github.com/P3TERX/aria2.conf/raw/master/dht.dat -o" + dhtpah + "dht.dat -O");
p2.setStandardOutputFile("/dev/null");
}

void MainFrame::initConnection()
Expand Down

0 comments on commit f720cab

Please sign in to comment.