[Pkg-owncloud-commits] [owncloud-client] 115/171: Upload: Chunk size can be changed in the config file
Sandro Knauß
hefee-guest at moszumanska.debian.org
Wed Feb 17 09:36:57 UTC 2016
This is an automated email from the git hooks/post-receive script.
hefee-guest pushed a commit to annotated tag upstream/2.1.1+dfsg
in repository owncloud-client.
commit d12c0939b90bd9a976b93e08bd2855d17de5ff3d
Author: Olivier Goffart <ogoffart at woboq.com>
Date: Fri Jan 15 13:16:52 2016 +0100
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
---
src/libsync/configfile.cpp | 7 +++++++
src/libsync/configfile.h | 1 +
src/libsync/owncloudpropagator.cpp | 14 ++++++++++++++
src/libsync/owncloudpropagator.h | 5 +++++
src/libsync/propagateupload.cpp | 11 -----------
src/libsync/propagateupload.h | 2 ++
6 files changed, 29 insertions(+), 11 deletions(-)
diff --git a/src/libsync/configfile.cpp b/src/libsync/configfile.cpp
index af54772..c1ee68c 100644
--- a/src/libsync/configfile.cpp
+++ b/src/libsync/configfile.cpp
@@ -49,6 +49,7 @@ static const char skipUpdateCheckC[] = "skipUpdateCheck";
static const char updateCheckIntervalC[] = "updateCheckInterval";
static const char geometryC[] = "geometry";
static const char timeoutC[] = "timeout";
+static const char chunkSizeC[] = "chunkSize";
static const char transmissionChecksumC[] = "transmissionChecksum";
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
}
+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
{
QSettings settings(configFile(), QSettings::IniFormat);
diff --git a/src/libsync/configfile.h b/src/libsync/configfile.h
index bc80f37..8875580 100644
--- a/src/libsync/configfile.h
+++ b/src/libsync/configfile.h
@@ -106,6 +106,7 @@ public:
void setOptionalDesktopNotifications(bool show);
int timeout() const;
+ quint64 chunkSize() const;
// send a checksum as a header along with the transmission or not.
// possible values:
diff --git a/src/libsync/owncloudpropagator.cpp b/src/libsync/owncloudpropagator.cpp
index db54bea..9d93b59 100644
--- a/src/libsync/owncloudpropagator.cpp
+++ b/src/libsync/owncloudpropagator.cpp
@@ -444,6 +444,20 @@ int OwncloudPropagator::httpTimeout()
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 re = false;
diff --git a/src/libsync/owncloudpropagator.h b/src/libsync/owncloudpropagator.h
index 718250d..321ce84 100644
--- a/src/libsync/owncloudpropagator.h
+++ b/src/libsync/owncloudpropagator.h
@@ -317,6 +317,9 @@ public:
// timeout in seconds
static int httpTimeout();
+ /** returns the size of chunks in bytes */
+ static quint64 chunkSize();
+
/** Records that a file was touched by a job.
*
* Thread-safe.
@@ -343,6 +346,8 @@ public:
*/
DiskSpaceResult diskSpaceCheck() const;
+
+
private slots:
/** Emit the finished signal and make sure it is only emitted once */
diff --git a/src/libsync/propagateupload.cpp b/src/libsync/propagateupload.cpp
index ff6c1da..92439b6 100644
--- a/src/libsync/propagateupload.cpp
+++ b/src/libsync/propagateupload.cpp
@@ -60,17 +60,6 @@ static bool fileIsStillChanging(const SyncFileItem & item)
&& 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()
{
// Make sure that we destroy the QNetworkReply before our _device of which it keeps an internal pointer.
diff --git a/src/libsync/propagateupload.h b/src/libsync/propagateupload.h
index e438357..a340f1a 100644
--- a/src/libsync/propagateupload.h
+++ b/src/libsync/propagateupload.h
@@ -188,6 +188,8 @@ private:
bool _deleteExisting;
+ quint64 chunkSize() const { return _propagator->chunkSize(); }
+
public:
PropagateUploadFileQNAM(OwncloudPropagator* propagator,const SyncFileItemPtr& item)
: PropagateItemJob(propagator, item), _startChunk(0), _currentChunk(0), _chunkCount(0), _transferId(0), _finished(false), _deleteExisting(false) {}
--
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-owncloud/owncloud-client.git
More information about the Pkg-owncloud-commits
mailing list