diff options
Diffstat (limited to 'src/libsync')
-rw-r--r-- | src/libsync/abstractnetworkjob.cpp | 5 | ||||
-rw-r--r-- | src/libsync/abstractnetworkjob.h | 4 | ||||
-rw-r--r-- | src/libsync/owncloudpropagator.cpp | 14 | ||||
-rw-r--r-- | src/libsync/owncloudpropagator.h | 3 |
4 files changed, 8 insertions, 18 deletions
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 { |