Skip to content

Commit

Permalink
Add debug info for files/folder syncing.
Browse files Browse the repository at this point in the history
Signed-off-by: Camila <[email protected]>
  • Loading branch information
Camila committed Jul 3, 2023
1 parent 719c6b2 commit 2586335
Show file tree
Hide file tree
Showing 3 changed files with 56 additions and 1 deletion.
28 changes: 28 additions & 0 deletions src/libsync/discovery.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -942,12 +942,25 @@ void ProcessDirectoryJob::processFileAnalyzeLocalInfo(
bool noServerEntry = (_queryServer != ParentNotChanged && !serverEntry.isValid())
|| (_queryServer == ParentNotChanged && !dbEntry.isValid());

qCInfo(lcDisco) << "** noServerEntry:" << noServerEntry;
qCInfo(lcDisco) << "** _queryServer:" << _queryServer;
qCInfo(lcDisco) << "** serverEntry.isValid():" << serverEntry.isValid();
qCInfo(lcDisco) << "** dbEntry.isValid():" << dbEntry.isValid();
qCInfo(lcDisco) << "** (_queryServer != ParentNotChanged && !serverEntry.isValid())" << (_queryServer != ParentNotChanged && !serverEntry.isValid());
qCInfo(lcDisco) << "** (_queryServer == ParentNotChanged && !dbEntry.isValid())" << (_queryServer == ParentNotChanged && !dbEntry.isValid());

if (noServerEntry)
recurseQueryServer = ParentDontExist;

bool serverModified = item->_instruction == CSYNC_INSTRUCTION_NEW || item->_instruction == CSYNC_INSTRUCTION_SYNC
|| item->_instruction == CSYNC_INSTRUCTION_RENAME || item->_instruction == CSYNC_INSTRUCTION_TYPE_CHANGE;

qCInfo(lcDisco) << "** serverModified:" << serverModified;
qCInfo(lcDisco) << "** item->_instruction == CSYNC_INSTRUCTION_NEW:" << (item->_instruction == CSYNC_INSTRUCTION_NEW);
qCInfo(lcDisco) << "** item->_instruction == CSYNC_INSTRUCTION_SYNC:" << (item->_instruction == CSYNC_INSTRUCTION_SYNC);
qCInfo(lcDisco) << "** item->_instruction == CSYNC_INSTRUCTION_RENAME:" << (item->_instruction == CSYNC_INSTRUCTION_RENAME);
qCInfo(lcDisco) << "** item->_instruction == CSYNC_INSTRUCTION_TYPE_CHANGE:" << (item->_instruction == CSYNC_INSTRUCTION_TYPE_CHANGE);

qCDebug(lcDisco) << "File" << item->_file << "- servermodified:" << serverModified
<< "noServerEntry:" << noServerEntry;

Expand Down Expand Up @@ -991,6 +1004,12 @@ void ProcessDirectoryJob::processFileAnalyzeLocalInfo(
// Not modified locally (ParentNotChanged)
if (noServerEntry) {
// not on the server: Removed on the server, delete locally
qCInfo(lcDisco) << "** ProcessDirectoryJob::processFileAnalyzeLocalInfo for" << item->_file;
qCInfo(lcDisco) << "** localEntry.isValid():" << localEntry.isValid();
qCInfo(lcDisco) << "** _queryLocal:" << _queryLocal;
qCInfo(lcDisco) << "** dbEntry.isValid():" << dbEntry.isValid();
qCInfo(lcDisco) << "** serverModified:" << serverModified;
qCInfo(lcDisco) << "** recurseQueryServer:" << recurseQueryServer;
#if !defined QT_NO_DEBUG
qCInfo(lcDisco) << "File" << item->_file << "is not anymore on server. Going to delete it locally.";
#endif
Expand Down Expand Up @@ -1062,6 +1081,15 @@ void ProcessDirectoryJob::processFileAnalyzeLocalInfo(
} else if (!typeChange && ((dbEntry._modtime == localEntry.modtime && dbEntry._fileSize == localEntry.size) || localEntry.isDirectory)) {
// Local file unchanged.
if (noServerEntry) {
qCInfo(lcDisco) << "** ProcessDirectoryJob::processFileAnalyzeLocalInfo for" << item->_file;
qCInfo(lcDisco) << "** typeChange:" << typeChange;
qCInfo(lcDisco) << "** dbEntry._modtime:" << dbEntry._modtime;
qCInfo(lcDisco) << "** localEntry.modtime:" << localEntry.modtime;
qCInfo(lcDisco) << "** dbEntry._fileSize:" << dbEntry._fileSize;
qCInfo(lcDisco) << "** localEntry.size:" << localEntry.size;
qCInfo(lcDisco) << "** localEntry.isDirectory:" << localEntry.isDirectory;
qCInfo(lcDisco) << "** serverModified:" << serverModified;
qCInfo(lcDisco) << "** recurseQueryServer:" << recurseQueryServer;
#if !defined QT_NO_DEBUG
qCInfo(lcDisco) << "File" << item->_file << "is not anymore on server. Going to delete it locally.";
#endif
Expand Down
23 changes: 23 additions & 0 deletions src/libsync/discoveryphase.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -422,6 +422,10 @@ static void propertyMapToRemoteInfo(const QMap<QString, QString> &map, RemoteInf
for (auto it = map.constBegin(); it != map.constEnd(); ++it) {
QString property = it.key();
QString value = it.value();

qWarning().noquote().nospace() << "** propertyMapToRemoteInfo **";
qWarning().noquote().nospace() << "** property [" << property << "]: " << value;

if (property == QLatin1String("resourcetype")) {
result.isDirectory = value.contains(QLatin1String("collection"));
} else if (property == QLatin1String("getlastmodified")) {
Expand Down Expand Up @@ -550,6 +554,25 @@ void DiscoverySingleDirectoryJob::directoryListingIteratedSlot(const QString &fi
result.name = file.mid(slash + 1);
result.size = -1;
propertyMapToRemoteInfo(map, result);
qWarning(lcDiscovery).noquote().nospace() << "** DiscoverySingleDirectoryJob::directoryListingIteratedSlot ** " << file;
qWarning(lcDiscovery).noquote().nospace() << "** result.isDirectory: " << result.isDirectory;
qWarning(lcDiscovery).noquote().nospace() << "** result.modtime: " << result.modtime;
qWarning(lcDiscovery).noquote().nospace() << "** result.size: " << result.size;
qWarning(lcDiscovery).noquote().nospace() << "** result.etag: " << result.etag;
qWarning(lcDiscovery).noquote().nospace() << "** result.fileId: " << result.fileId;
qWarning(lcDiscovery).noquote().nospace() << "** result.directDownloadUrl: " << result.directDownloadUrl;
qWarning(lcDiscovery).noquote().nospace() << "** result.directDownloadCookies: " << result.directDownloadCookies;
qWarning(lcDiscovery).noquote().nospace() << "** result.remotePerm: " << result.remotePerm;
qWarning(lcDiscovery).noquote().nospace() << "** result.checksumHeader: " << result.checksumHeader;
qWarning(lcDiscovery).noquote().nospace() << "** result.sharedByMe: " << result.sharedByMe;
qWarning(lcDiscovery).noquote().nospace() << "** result._isE2eEncrypted: " << result._isE2eEncrypted;
qWarning(lcDiscovery).noquote().nospace() << "** result.locked: " << result.locked;
qWarning(lcDiscovery).noquote().nospace() << "** result.lockOwnerDisplayName: " << result.lockOwnerDisplayName;
qWarning(lcDiscovery).noquote().nospace() << "** result.lockOwnerId: " << result.lockOwnerId;
qWarning(lcDiscovery).noquote().nospace() << "** result.lockOwnerType: " << result.lockOwnerType;
qWarning(lcDiscovery).noquote().nospace() << "** result.lockEditorApp: " << result.lockEditorApp;
qWarning(lcDiscovery).noquote().nospace() << "** result.lockTime: " << result.lockTime;
qWarning(lcDiscovery).noquote().nospace() << "** result.lockTimeout: " << result.lockTimeout;
if (result.isDirectory)
result.size = 0;

Expand Down
6 changes: 5 additions & 1 deletion src/libsync/networkjobs.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -223,9 +223,11 @@ bool LsColXMLParser::parse(const QByteArray &xml, QHash<QString, ExtraFolderInfo
bool insideProp = false;
bool insideMultiStatus = false;

qCWarning(lcLsColJob).noquote().nospace() << "** LsColXMLParser::parse ** " << expectedPath;
while (!reader.atEnd()) {
QXmlStreamReader::TokenType type = reader.readNext();
QString name = reader.name().toString();

// Start elements with DAV:
if (type == QXmlStreamReader::StartElement && reader.namespaceUri() == QLatin1String("DAV:")) {
if (name == QLatin1String("href")) {
Expand Down Expand Up @@ -272,7 +274,9 @@ bool LsColXMLParser::parse(const QByteArray &xml, QHash<QString, ExtraFolderInfo
} else if (name == QLatin1String("fileid")) {
(*fileInfo)[currentHref].fileId = propertyContent.toUtf8();
}
currentTmpProperties.insert(reader.name().toString(), propertyContent);
const auto property = reader.name().toString();
currentTmpProperties.insert(property, propertyContent);
qCWarning(lcLsColJob).noquote().nospace() << "** " << currentHref << "[" << property << "]: " << propertyContent;
}

// End elements with DAV:
Expand Down

0 comments on commit 2586335

Please sign in to comment.