Bladeren bron

During synchronization transfer speed limit is preserved across set of synchronized directories

Source commit: bd0bf6cbae4fd2f2e2e657587962e897084dc374
Martin Prikryl 7 jaren geleden
bovenliggende
commit
6290dac894
4 gewijzigde bestanden met toevoegingen van 21 en 14 verwijderingen
  1. 11 6
      source/core/Terminal.cpp
  2. 6 4
      source/core/Terminal.h
  3. 2 2
      source/forms/CustomScpExplorer.cpp
  4. 2 2
      source/forms/CustomScpExplorer.h

+ 11 - 6
source/core/Terminal.cpp

@@ -6559,15 +6559,17 @@ int __fastcall TTerminal::CopyToParallel(TParallelOperation * ParallelOperation,
     try
     {
       FOperationProgress = OperationProgress;
+      // Need own copy, now that CopyToRemote/CopyToLocal modify the instance
+      TCopyParamType CopyParam = *ParallelOperation->CopyParam;
       if (ParallelOperation->Side == osLocal)
       {
         FFileSystem->CopyToRemote(
-          FilesToCopy.get(), TargetDir, ParallelOperation->CopyParam, Params, OperationProgress, OnceDoneOperation);
+          FilesToCopy.get(), TargetDir, &CopyParam, Params, OperationProgress, OnceDoneOperation);
       }
       else if (DebugAlwaysTrue(ParallelOperation->Side == osRemote))
       {
         FFileSystem->CopyToLocal(
-          FilesToCopy.get(), TargetDir, ParallelOperation->CopyParam, Params, OperationProgress, OnceDoneOperation);
+          FilesToCopy.get(), TargetDir, &CopyParam, Params, OperationProgress, OnceDoneOperation);
       }
     }
     __finally
@@ -6664,8 +6666,9 @@ void __fastcall TTerminal::LogTotalTransferDone(TFileOperationProgressType * Ope
   LogEvent(L"Copying finished: " + OperationProgress->GetLogStr(true));
 }
 //---------------------------------------------------------------------------
-bool __fastcall TTerminal::CopyToRemote(TStrings * FilesToCopy,
-  const UnicodeString TargetDir, const TCopyParamType * CopyParam, int Params, TParallelOperation * ParallelOperation)
+bool __fastcall TTerminal::CopyToRemote(
+  TStrings * FilesToCopy, const UnicodeString & TargetDir, TCopyParamType * CopyParam, int Params,
+  TParallelOperation * ParallelOperation)
 {
   DebugAssert(FFileSystem);
   DebugAssert(FilesToCopy);
@@ -6753,6 +6756,7 @@ bool __fastcall TTerminal::CopyToRemote(TStrings * FilesToCopy,
         Configuration->Usage->Inc(L"UploadTime", CounterTime);
         Configuration->Usage->SetMax(L"MaxUploadTime", CounterTime);
       }
+      CopyParam->CPSLimit = OperationProgress.CPSLimit;
       OperationProgress.Stop();
       FOperationProgress = NULL;
     }
@@ -7085,8 +7089,8 @@ void __fastcall TTerminal::Source(
   UpdateSource(Handle, CopyParam, Params);
 }
 //---------------------------------------------------------------------------
-bool __fastcall TTerminal::CopyToLocal(TStrings * FilesToCopy,
-  const UnicodeString TargetDir, const TCopyParamType * CopyParam, int Params,
+bool __fastcall TTerminal::CopyToLocal(
+  TStrings * FilesToCopy, const UnicodeString & TargetDir, TCopyParamType * CopyParam, int Params,
   TParallelOperation * ParallelOperation)
 {
   DebugAssert(FFileSystem);
@@ -7199,6 +7203,7 @@ bool __fastcall TTerminal::CopyToLocal(TStrings * FilesToCopy,
         Configuration->Usage->Inc(L"DownloadTime", CounterTime);
         Configuration->Usage->SetMax(L"MaxDownloadTime", CounterTime);
       }
+      CopyParam->CPSLimit = OperationProgress.CPSLimit;
       FOperationProgress = NULL;
       OperationProgress.Stop();
     }

+ 6 - 4
source/core/Terminal.h

@@ -503,10 +503,12 @@ public:
   void __fastcall ReadFile(const UnicodeString FileName, TRemoteFile *& File);
   bool __fastcall FileExists(const UnicodeString FileName, TRemoteFile ** File = NULL);
   void __fastcall ReadSymlink(TRemoteFile * SymlinkFile, TRemoteFile *& File);
-  bool __fastcall CopyToLocal(TStrings * FilesToCopy,
-    const UnicodeString TargetDir, const TCopyParamType * CopyParam, int Params, TParallelOperation * ParallelOperation);
-  bool __fastcall CopyToRemote(TStrings * FilesToCopy,
-    const UnicodeString TargetDir, const TCopyParamType * CopyParam, int Params, TParallelOperation * ParallelOperation);
+  bool __fastcall CopyToLocal(
+    TStrings * FilesToCopy, const UnicodeString & TargetDir, TCopyParamType * CopyParam, int Params,
+    TParallelOperation * ParallelOperation);
+  bool __fastcall CopyToRemote(
+    TStrings * FilesToCopy, const UnicodeString & TargetDir, TCopyParamType * CopyParam, int Params,
+    TParallelOperation * ParallelOperation);
   int __fastcall CopyToParallel(TParallelOperation * ParallelOperation, TFileOperationProgressType * OperationProgress);
   void __fastcall LogParallelTransfer(TParallelOperation * ParallelOperation);
   void __fastcall CreateDirectory(const UnicodeString & DirName, const TRemoteProperties * Properties);

+ 2 - 2
source/forms/CustomScpExplorer.cpp

@@ -7283,8 +7283,8 @@ void __fastcall TCustomScpExplorerForm::RemoteFileControlDDTargetDrop()
   }
 }
 //---------------------------------------------------------------------------
-void __fastcall TCustomScpExplorerForm::DDDownload(TStrings * FilesToCopy,
-  const UnicodeString TargetDir, const TCopyParamType * CopyParam, int Params)
+void __fastcall TCustomScpExplorerForm::DDDownload(
+  TStrings * FilesToCopy, const UnicodeString & TargetDir, TCopyParamType * CopyParam, int Params)
 {
   void * BatchStorage;
   BatchStart(BatchStorage);

+ 2 - 2
source/forms/CustomScpExplorer.h

@@ -460,8 +460,8 @@ protected:
   void __fastcall RemoteFileControlDDTargetDrop();
   bool __fastcall RemoteFileControlFileOperation(TObject * Sender,
     TFileOperation Operation, bool NoConfirmation, void * Param);
-  void __fastcall DDDownload(TStrings * FilesToCopy,
-    const UnicodeString TargetDir, const TCopyParamType * CopyParam, int Params);
+  void __fastcall DDDownload(
+    TStrings * FilesToCopy, const UnicodeString & TargetDir, TCopyParamType * CopyParam, int Params);
   bool __fastcall EnsureCommandSessionFallback(TFSCapability Capability);
   bool __fastcall CommandSessionFallback();
   void __fastcall FileTerminalRemoved(const UnicodeString FileName,