Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/owncloud/client.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorOlivier Goffart <ogoffart@woboq.com>2017-12-05 20:11:09 +0300
committerOlivier Goffart <ogoffart@woboq.com>2017-12-07 19:39:16 +0300
commitac844a2a45af5579c4013a02f6efc93fa83dc79f (patch)
treeb9745822efdae7eb14095d7dd919de3d47c95a2b
parent7230fa6b4fb0d077bc82814074aeb853ed45345f (diff)
AbstractNetworkJob: move the httpTimeout from the propagator to the network job
Remove one dependency from the config file for the sync engine. Part of issue #6213
-rw-r--r--src/gui/application.cpp6
-rw-r--r--src/libsync/abstractnetworkjob.cpp5
-rw-r--r--src/libsync/abstractnetworkjob.h4
-rw-r--r--src/libsync/owncloudpropagator.cpp14
-rw-r--r--src/libsync/owncloudpropagator.h3
5 files changed, 13 insertions, 19 deletions
diff --git a/src/gui/application.cpp b/src/gui/application.cpp
index 88a2c5c08..1f8b53be8 100644
--- a/src/gui/application.cpp
+++ b/src/gui/application.cpp
@@ -139,6 +139,11 @@ Application::Application(int &argc, char **argv)
setupLogging();
setupTranslations();
+ // The timeout is initialized with an environment variable, if not, override with the value from the config
+ ConfigFile cfg;
+ if (!AbstractNetworkJob::httpTimeout)
+ AbstractNetworkJob::httpTimeout = cfg.timeout();
+
_folderManager.reset(new FolderMan);
connect(this, &SharedTools::QtSingleApplication::messageReceived, this, &Application::slotParseMessage);
@@ -166,7 +171,6 @@ Application::Application(int &argc, char **argv)
setQuitOnLastWindowClosed(false);
- ConfigFile cfg;
_theme->setSystrayUseMonoIcons(cfg.monoIcons());
connect(_theme, &Theme::systrayUseMonoIconsChanged, this, &Application::slotUseMonoIconsChanged);
diff --git a/src/libsync/abstractnetworkjob.cpp b/src/libsync/abstractnetworkjob.cpp
index 78d5b9ab6..0149bec42 100644
--- a/src/libsync/abstractnetworkjob.cpp
+++ b/src/libsync/abstractnetworkjob.cpp
@@ -40,6 +40,9 @@ namespace OCC {
Q_LOGGING_CATEGORY(lcNetworkJob, "sync.networkjob", QtInfoMsg)
+// If not set, it is overwritten by the Application constructor with the value from the config
+int AbstractNetworkJob::httpTimeout = qEnvironmentVariableIntValue("OWNCLOUD_TIMEOUT");
+
AbstractNetworkJob::AbstractNetworkJob(AccountPtr account, const QString &path, QObject *parent)
: QObject(parent)
, _timedout(false)
@@ -51,7 +54,7 @@ AbstractNetworkJob::AbstractNetworkJob(AccountPtr account, const QString &path,
, _redirectCount(0)
{
_timer.setSingleShot(true);
- _timer.setInterval(OwncloudPropagator::httpTimeout() * 1000); // default to 5 minutes.
+ _timer.setInterval((httpTimeout ? httpTimeout : 300) * 1000); // default to 5 minutes.
connect(&_timer, &QTimer::timeout, this, &AbstractNetworkJob::slotTimeout);
connect(this, &AbstractNetworkJob::networkActivity, this, &AbstractNetworkJob::resetTimeout);
diff --git a/src/libsync/abstractnetworkjob.h b/src/libsync/abstractnetworkjob.h
index ec9a31add..b49f72282 100644
--- a/src/libsync/abstractnetworkjob.h
+++ b/src/libsync/abstractnetworkjob.h
@@ -88,6 +88,10 @@ public:
*/
QString errorStringParsingBody(QByteArray *body = 0);
+ /** static variable the HTTP timeout (in seconds). If set to 0, the default will be used
+ */
+ static int httpTimeout;
+
public slots:
void setTimeout(qint64 msec);
void resetTimeout();
diff --git a/src/libsync/owncloudpropagator.cpp b/src/libsync/owncloudpropagator.cpp
index d90ae8af7..e1d081141 100644
--- a/src/libsync/owncloudpropagator.cpp
+++ b/src/libsync/owncloudpropagator.cpp
@@ -22,7 +22,6 @@
#include "propagateremotemove.h"
#include "propagateremotemkdir.h"
#include "propagatorjobs.h"
-#include "configfile.h"
#include "common/utility.h"
#include "account.h"
#include "common/asserts.h"
@@ -554,19 +553,6 @@ bool OwncloudPropagator::isInSharedDirectory(const QString &file)
return re;
}
-int OwncloudPropagator::httpTimeout()
-{
- static int timeout = 0;
- if (!timeout) {
- timeout = qgetenv("OWNCLOUD_TIMEOUT").toUInt();
- if (timeout == 0) {
- ConfigFile cfg;
- timeout = cfg.timeout();
- }
- }
- return timeout;
-}
-
bool OwncloudPropagator::localFileNameClash(const QString &relFile)
{
bool re = false;
diff --git a/src/libsync/owncloudpropagator.h b/src/libsync/owncloudpropagator.h
index efc7c01dd..062b3825e 100644
--- a/src/libsync/owncloudpropagator.h
+++ b/src/libsync/owncloudpropagator.h
@@ -464,9 +464,6 @@ public:
}
}
- // timeout in seconds
- static int httpTimeout();
-
AccountPtr account() const;
enum DiskSpaceResult {