Checksum: Fixes after review
authorChristian Kamm <mail@ckamm.de>
Wed, 28 Oct 2015 13:22:29 +0000 (14:22 +0100)
committerChristian Kamm <mail@ckamm.de>
Wed, 28 Oct 2015 13:46:20 +0000 (14:46 +0100)
src/libsync/capabilities.cpp
src/libsync/capabilities.h
src/libsync/propagateupload.cpp

index 81f8d98461bc96258ffda16c8f137260784da56a..202be49379d1ae3a42693191d0647599de5f5a63 100644 (file)
@@ -65,14 +65,14 @@ bool Capabilities::shareResharing() const
     return _capabilities["files_sharing"].toMap()["resharing"].toBool();
 }
 
-QList<QByteArray> Capabilities::supportedChecksumTypesRaw() const
+QList<QByteArray> Capabilities::supportedChecksumTypesAdvertised() const
 {
     return QList<QByteArray>();
 }
 
 QList<QByteArray> Capabilities::supportedChecksumTypes() const
 {
-    auto list = supportedChecksumTypesRaw();
+    auto list = supportedChecksumTypesAdvertised();
     QByteArray cfgType = ConfigFile().transmissionChecksum().toLatin1();
     if (!cfgType.isEmpty()) {
         list.prepend(cfgType);
index 7f0984cc2e94873db9ff841bb55f423b4c861a16..963c4cb53afe81efe62ba002ab91cf25d682689a 100644 (file)
@@ -41,7 +41,7 @@ public:
     bool shareResharing() const;
 
     /// Returns the checksum types the server explicitly advertises
-    QList<QByteArray> supportedChecksumTypesRaw() const;
+    QList<QByteArray> supportedChecksumTypesAdvertised() const;
 
     /// Like supportedChecksumTypesRaw(), but includes the type from the config
     QList<QByteArray> supportedChecksumTypes() const;
index 10724a41742f6176498664213e15605ba20123bc..eb509a21cdb3fbe1267d3190a753e6f0fa364290 100644 (file)
@@ -213,6 +213,10 @@ void PropagateUploadFileQNAM::start()
 
     // If we already have a checksum header and the checksum type is supported
     // by the server, we keep that - otherwise recompute.
+    //
+    // Note: Currently we *always* recompute because we usually only upload
+    // files that have changed and thus have a new checksum. But if an earlier
+    // phase computed a checksum, this is where we would make use of it.
     if (!_item->_transmissionChecksumType.isEmpty()) {
         if (supportedChecksumTypes.contains(_item->_transmissionChecksumType)) {
             // TODO: We could validate the old checksum and thereby determine whether