[Pkg-owncloud-commits] [owncloud-client] 99/164: ETags: For Folder and RequestEtagJob, always use Concatenation
Sandro Knauß
hefee-guest at moszumanska.debian.org
Sun Mar 22 11:56:58 UTC 2015
This is an automated email from the git hooks/post-receive script.
hefee-guest pushed a commit to branch master
in repository owncloud-client.
commit 3f712dce02d647124022f464a4fd06e65d0e2d83
Author: Markus Goetz <markus at woboq.com>
Date: Thu Mar 5 17:49:12 2015 +0100
ETags: For Folder and RequestEtagJob, always use Concatenation
---
src/libsync/discoveryphase.cpp | 13 ++++++++-----
src/libsync/discoveryphase.h | 5 +++--
src/libsync/networkjobs.cpp | 16 ++++++----------
src/libsync/syncengine.cpp | 2 +-
4 files changed, 18 insertions(+), 18 deletions(-)
diff --git a/src/libsync/discoveryphase.cpp b/src/libsync/discoveryphase.cpp
index 8a47f9a..3fb2ca1 100644
--- a/src/libsync/discoveryphase.cpp
+++ b/src/libsync/discoveryphase.cpp
@@ -254,9 +254,7 @@ void DiscoverySingleDirectoryJob::directoryListingIteratedSlot(QString file,QMap
if (map.contains("permissions")) {
emit firstDirectoryPermissions(map.value("permissions"));
}
- if (map.contains("getetag")) {
- emit firstDirectoryEtag(map.value("getetag"));
- }
+
} else {
// Remove /remote.php/webdav/folder/ from /remote.php/webdav/folder/subfile.txt
file.remove(0, _lsColJob->reply()->request().url().path().length());
@@ -276,10 +274,15 @@ void DiscoverySingleDirectoryJob::directoryListingIteratedSlot(QString file,QMap
_results.append(file_stat);
}
+ //This works in concerto with the RequestEtagJob and the Folder object to check if the remote folder changed.
+ if (map.contains("getetag")) {
+ _etagConcatenation += map.value("getetag");
+ }
}
void DiscoverySingleDirectoryJob::lsJobFinishedWithoutErrorSlot()
{
+ emit etagConcatenation(_etagConcatenation);
emit finishedWithResult(_results);
deleteLater();
}
@@ -352,8 +355,8 @@ void DiscoveryMainThread::doOpendirSlot(QString subPath, DiscoveryDirectoryResul
this, SLOT(singleDirectoryJobFinishedWithErrorSlot(int,QString)));
QObject::connect(_singleDirJob, SIGNAL(firstDirectoryPermissions(QString)),
this, SLOT(singleDirectoryJobFirstDirectoryPermissionsSlot(QString)));
- QObject::connect(_singleDirJob, SIGNAL(firstDirectoryEtag(QString)),
- this, SIGNAL(rootEtag(QString)));
+ QObject::connect(_singleDirJob, SIGNAL(etagConcatenation(QString)),
+ this, SIGNAL(etagConcatenation(QString)));
_singleDirJob->start();
}
diff --git a/src/libsync/discoveryphase.h b/src/libsync/discoveryphase.h
index a4ce848..b1989d0 100644
--- a/src/libsync/discoveryphase.h
+++ b/src/libsync/discoveryphase.h
@@ -52,7 +52,7 @@ public:
// This is not actually a network job, it is just a job
signals:
void firstDirectoryPermissions(const QString &);
- void firstDirectoryEtag(const QString &);
+ void etagConcatenation(const QString &);
void finishedWithResult(QLinkedList<csync_vio_file_stat_t*>);
void finishedWithError(int csyncErrnoCode, QString msg);
private slots:
@@ -62,6 +62,7 @@ private slots:
private:
QLinkedList<csync_vio_file_stat_t*> _results;
QString _subPath;
+ QString _etagConcatenation;
AccountPtr _account;
bool _ignoredFirst;
QPointer<LsColJob> _lsColJob;
@@ -116,7 +117,7 @@ public slots:
void singleDirectoryJobFinishedWithErrorSlot(int csyncErrnoCode, QString msg);
void singleDirectoryJobFirstDirectoryPermissionsSlot(QString);
signals:
- void rootEtag(QString);
+ void etagConcatenation(QString);
public:
void setupHooks(DiscoveryJob* discoveryJob, const QString &pathPrefix);
};
diff --git a/src/libsync/networkjobs.cpp b/src/libsync/networkjobs.cpp
index e592fb7..3de56fc 100644
--- a/src/libsync/networkjobs.cpp
+++ b/src/libsync/networkjobs.cpp
@@ -248,16 +248,12 @@ RequestEtagJob::RequestEtagJob(AccountPtr account, const QString &path, QObject
void RequestEtagJob::start()
{
QNetworkRequest req;
- if (path().isEmpty() || path() == QLatin1String("/")) {
- /* For the root directory, we need to query the etags of all the sub directories
- * because, at the time I am writing this comment (Owncloud 5.0.9), the etag of the
- * root directory is not updated when the sub directories changes */
- //req.setRawHeader("Depth", "1");
- //This should be fixed since oC6 https://github.com/owncloud/core/issues/5255
- req.setRawHeader("Depth", "0");
- } else {
- req.setRawHeader("Depth", "0");
- }
+ // Let's always request all entries inside a directory. There are/were bugs in the server
+ // where a root or root-folder ETag is not updated when its contents change. We work around
+ // this by concatenating the ETags of the root and its contents.
+ req.setRawHeader("Depth", "1");
+ // See https://github.com/owncloud/core/issues/5255 and others
+
QByteArray xml("<?xml version=\"1.0\" ?>\n"
"<d:propfind xmlns:d=\"DAV:\">\n"
" <d:prop>\n"
diff --git a/src/libsync/syncengine.cpp b/src/libsync/syncengine.cpp
index b86ea2b..5b5132d 100644
--- a/src/libsync/syncengine.cpp
+++ b/src/libsync/syncengine.cpp
@@ -636,7 +636,7 @@ void SyncEngine::startSync()
_discoveryMainThread = new DiscoveryMainThread(account());
_discoveryMainThread->setParent(this);
connect(this, SIGNAL(finished()), _discoveryMainThread, SLOT(deleteLater()));
- connect(_discoveryMainThread, SIGNAL(rootEtag(QString)), this, SLOT(slotRootEtagReceived(QString)));
+ connect(_discoveryMainThread, SIGNAL(etagConcatenation(QString)), this, SLOT(slotRootEtagReceived(QString)));
DiscoveryJob *discoveryJob = new DiscoveryJob(_csync_ctx);
--
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