Merge pull request #10869 from Chocobo1/backport

Backport to v4_1_x
This commit is contained in:
Mike Tzou 2019-07-06 12:17:33 +08:00 committed by GitHub
commit e954835579
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 19 additions and 3 deletions

View file

@ -101,6 +101,7 @@ QtLocalPeer::QtLocalPeer(QObject* parent, const QString &appId)
#endif #endif
server = new QLocalServer(this); server = new QLocalServer(this);
server->setSocketOptions(QLocalServer::UserAccessOption);
QString lockName = QDir(QDir::tempPath()).absolutePath() QString lockName = QDir(QDir::tempPath()).absolutePath()
+ QLatin1Char('/') + socketName + QLatin1Char('/') + socketName
+ QLatin1String("-lockfile"); + QLatin1String("-lockfile");
@ -191,6 +192,12 @@ void QtLocalPeer::receiveConnection()
QByteArray uMsg; QByteArray uMsg;
quint32 remaining; quint32 remaining;
ds >> remaining; ds >> remaining;
if (remaining > 65535) {
// drop suspiciously large data
delete socket;
return;
}
uMsg.resize(remaining); uMsg.resize(remaining);
int got = 0; int got = 0;
char* uMsgBuf = uMsg.data(); char* uMsgBuf = uMsg.data();

View file

@ -4316,9 +4316,14 @@ void Session::handleTorrentDeleteFailedAlert(libt::torrent_delete_failed_alert *
// so we remove the directory ourselves // so we remove the directory ourselves
Utils::Fs::smartRemoveEmptyFolderTree(tmpRemovingTorrentData.savePathToRemove); Utils::Fs::smartRemoveEmptyFolderTree(tmpRemovingTorrentData.savePathToRemove);
LogMsg(tr("'%1' was removed from the transfer list but the files couldn't be deleted. Error: %2", "'xxx.avi' was removed...") if (p->error) {
.arg(tmpRemovingTorrentData.name, QString::fromLocal8Bit(p->error.message().c_str())) LogMsg(tr("'%1' was removed from the transfer list but the files couldn't be deleted. Error: %2", "'xxx.avi' was removed...")
, Log::CRITICAL); .arg(tmpRemovingTorrentData.name, QString::fromStdString(p->error.message()))
, Log::WARNING);
}
else {
LogMsg(tr("'%1' was removed from the transfer list.", "'xxx.avi' was removed...").arg(tmpRemovingTorrentData.name));
}
} }
void Session::handleMetadataReceivedAlert(libt::metadata_received_alert *p) void Session::handleMetadataReceivedAlert(libt::metadata_received_alert *p)

View file

@ -1285,6 +1285,8 @@ void TorrentHandle::setSequentialDownload(bool b)
m_nativeHandle.set_sequential_download(b); m_nativeHandle.set_sequential_download(b);
m_nativeStatus.sequential_download = b; // prevent return cached value m_nativeStatus.sequential_download = b; // prevent return cached value
} }
saveResumeData();
} }
void TorrentHandle::toggleSequentialDownload() void TorrentHandle::toggleSequentialDownload()
@ -1331,6 +1333,8 @@ void TorrentHandle::setFirstLastPiecePriorityImpl(const bool enabled, const QVec
LogMsg(tr("Download first and last piece first: %1, torrent: '%2'") LogMsg(tr("Download first and last piece first: %1, torrent: '%2'")
.arg((enabled ? tr("On") : tr("Off")), name())); .arg((enabled ? tr("On") : tr("Off")), name()));
saveResumeData();
} }
void TorrentHandle::toggleFirstLastPiecePriority() void TorrentHandle::toggleFirstLastPiecePriority()