Bläddra i källkod

Checksum: Fixes after review

Christian Kamm 10 år sedan
förälder
incheckning
566131209d
3 ändrade filer med 7 tillägg och 3 borttagningar
  1. 2 2
      src/libsync/capabilities.cpp
  2. 1 1
      src/libsync/capabilities.h
  3. 4 0
      src/libsync/propagateupload.cpp

+ 2 - 2
src/libsync/capabilities.cpp

@@ -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);

+ 1 - 1
src/libsync/capabilities.h

@@ -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;

+ 4 - 0
src/libsync/propagateupload.cpp

@@ -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