mirror of
https://github.com/nextcloud/desktop.git
synced 2024-11-23 13:35:58 +03:00
Upload: Chunk size can be changed in the config file
Added a new "chunkSize" entry in the General group of the owncloud.cfg which can be set to the size, in bytes, of the chunks. This allow user with hude bandwidth to select more optimal chunk size Issue #4354
This commit is contained in:
parent
a41fbc0454
commit
d12c0939b9
6 changed files with 29 additions and 11 deletions
|
@ -49,6 +49,7 @@ static const char skipUpdateCheckC[] = "skipUpdateCheck";
|
||||||
static const char updateCheckIntervalC[] = "updateCheckInterval";
|
static const char updateCheckIntervalC[] = "updateCheckInterval";
|
||||||
static const char geometryC[] = "geometry";
|
static const char geometryC[] = "geometry";
|
||||||
static const char timeoutC[] = "timeout";
|
static const char timeoutC[] = "timeout";
|
||||||
|
static const char chunkSizeC[] = "chunkSize";
|
||||||
static const char transmissionChecksumC[] = "transmissionChecksum";
|
static const char transmissionChecksumC[] = "transmissionChecksum";
|
||||||
|
|
||||||
static const char proxyHostC[] = "Proxy/host";
|
static const char proxyHostC[] = "Proxy/host";
|
||||||
|
@ -120,6 +121,12 @@ int ConfigFile::timeout() const
|
||||||
return settings.value(QLatin1String(timeoutC), 300).toInt(); // default to 5 min
|
return settings.value(QLatin1String(timeoutC), 300).toInt(); // default to 5 min
|
||||||
}
|
}
|
||||||
|
|
||||||
|
quint64 ConfigFile::chunkSize() const
|
||||||
|
{
|
||||||
|
QSettings settings(configFile(), QSettings::IniFormat);
|
||||||
|
return settings.value(QLatin1String(chunkSizeC), 5*1024*1024).toLongLong(); // default to 5 MiB
|
||||||
|
}
|
||||||
|
|
||||||
QString ConfigFile::transmissionChecksum() const
|
QString ConfigFile::transmissionChecksum() const
|
||||||
{
|
{
|
||||||
QSettings settings(configFile(), QSettings::IniFormat);
|
QSettings settings(configFile(), QSettings::IniFormat);
|
||||||
|
|
|
@ -106,6 +106,7 @@ public:
|
||||||
void setOptionalDesktopNotifications(bool show);
|
void setOptionalDesktopNotifications(bool show);
|
||||||
|
|
||||||
int timeout() const;
|
int timeout() const;
|
||||||
|
quint64 chunkSize() const;
|
||||||
|
|
||||||
// send a checksum as a header along with the transmission or not.
|
// send a checksum as a header along with the transmission or not.
|
||||||
// possible values:
|
// possible values:
|
||||||
|
|
|
@ -444,6 +444,20 @@ int OwncloudPropagator::httpTimeout()
|
||||||
return timeout;
|
return timeout;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
quint64 OwncloudPropagator::chunkSize()
|
||||||
|
{
|
||||||
|
static uint chunkSize;
|
||||||
|
if (!chunkSize) {
|
||||||
|
chunkSize = qgetenv("OWNCLOUD_CHUNK_SIZE").toUInt();
|
||||||
|
if (chunkSize == 0) {
|
||||||
|
ConfigFile cfg;
|
||||||
|
chunkSize = cfg.chunkSize();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return chunkSize;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
bool OwncloudPropagator::localFileNameClash( const QString& relFile )
|
bool OwncloudPropagator::localFileNameClash( const QString& relFile )
|
||||||
{
|
{
|
||||||
bool re = false;
|
bool re = false;
|
||||||
|
|
|
@ -317,6 +317,9 @@ public:
|
||||||
// timeout in seconds
|
// timeout in seconds
|
||||||
static int httpTimeout();
|
static int httpTimeout();
|
||||||
|
|
||||||
|
/** returns the size of chunks in bytes */
|
||||||
|
static quint64 chunkSize();
|
||||||
|
|
||||||
/** Records that a file was touched by a job.
|
/** Records that a file was touched by a job.
|
||||||
*
|
*
|
||||||
* Thread-safe.
|
* Thread-safe.
|
||||||
|
@ -343,6 +346,8 @@ public:
|
||||||
*/
|
*/
|
||||||
DiskSpaceResult diskSpaceCheck() const;
|
DiskSpaceResult diskSpaceCheck() const;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
private slots:
|
private slots:
|
||||||
|
|
||||||
/** Emit the finished signal and make sure it is only emitted once */
|
/** Emit the finished signal and make sure it is only emitted once */
|
||||||
|
|
|
@ -60,17 +60,6 @@ static bool fileIsStillChanging(const SyncFileItem & item)
|
||||||
&& msSinceMod > -10000;
|
&& msSinceMod > -10000;
|
||||||
}
|
}
|
||||||
|
|
||||||
static qint64 chunkSize() {
|
|
||||||
static uint chunkSize;
|
|
||||||
if (!chunkSize) {
|
|
||||||
chunkSize = qgetenv("OWNCLOUD_CHUNK_SIZE").toUInt();
|
|
||||||
if (chunkSize == 0) {
|
|
||||||
chunkSize = 5*1024*1024; // default to 5 MiB
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return chunkSize;
|
|
||||||
}
|
|
||||||
|
|
||||||
PUTFileJob::~PUTFileJob()
|
PUTFileJob::~PUTFileJob()
|
||||||
{
|
{
|
||||||
// Make sure that we destroy the QNetworkReply before our _device of which it keeps an internal pointer.
|
// Make sure that we destroy the QNetworkReply before our _device of which it keeps an internal pointer.
|
||||||
|
|
|
@ -188,6 +188,8 @@ private:
|
||||||
|
|
||||||
bool _deleteExisting;
|
bool _deleteExisting;
|
||||||
|
|
||||||
|
quint64 chunkSize() const { return _propagator->chunkSize(); }
|
||||||
|
|
||||||
public:
|
public:
|
||||||
PropagateUploadFileQNAM(OwncloudPropagator* propagator,const SyncFileItemPtr& item)
|
PropagateUploadFileQNAM(OwncloudPropagator* propagator,const SyncFileItemPtr& item)
|
||||||
: PropagateItemJob(propagator, item), _startChunk(0), _currentChunk(0), _chunkCount(0), _transferId(0), _finished(false), _deleteExisting(false) {}
|
: PropagateItemJob(propagator, item), _startChunk(0), _currentChunk(0), _chunkCount(0), _transferId(0), _finished(false), _deleteExisting(false) {}
|
||||||
|
|
Loading…
Reference in a new issue