Pārlūkot izejas kodu

Logging start of additional parallel transfers

Source commit: 87d4db0bfbb7d579160446b1ae3e213fd94c5116
Martin Prikryl 8 gadi atpakaļ
vecāks
revīzija
20492966bd
3 mainītis faili ar 16 papildinājumiem un 4 dzēšanām
  1. 1 0
      source/core/Queue.cpp
  2. 11 3
      source/core/Terminal.cpp
  3. 4 1
      source/core/Terminal.h

+ 1 - 0
source/core/Queue.cpp

@@ -2216,6 +2216,7 @@ void __fastcall TParallelTransferQueueItem::DoExecute(TTerminal * Terminal)
 {
   TLocatedQueueItem::DoExecute(Terminal);
 
+  Terminal->LogParallelTransfer(FParallelOperation);
   TFileOperationProgressType OperationProgress(Terminal->OnProgress, Terminal->OnFinished, FParallelOperation->MainOperationProgress);
   TFileOperation Operation = (FLAGSET(FParallelOperation->Params, cpDelete) ? foMove : foCopy);
   bool Temp = FLAGSET(FParallelOperation->Params, cpTemporary);

+ 11 - 3
source/core/Terminal.cpp

@@ -759,7 +759,7 @@ TParallelOperation::TParallelOperation(TOperationSide Side)
 //---------------------------------------------------------------------------
 void TParallelOperation::Init(
   TStrings * AFileList, const UnicodeString & TargetDir, const TCopyParamType * CopyParam, int Params,
-  TFileOperationProgressType * MainOperationProgress)
+  TFileOperationProgressType * MainOperationProgress, const UnicodeString & MainName)
 {
   DebugAssert(FFileList.get() == NULL);
   // More lists should really happen in scripting only, which does not support parallel transfers atm.
@@ -771,6 +771,7 @@ void TParallelOperation::Init(
   FCopyParam = CopyParam;
   FParams = Params;
   FMainOperationProgress = MainOperationProgress;
+  FMainName = MainName;
   FIndex = 0;
 }
 //---------------------------------------------------------------------------
@@ -6355,6 +6356,13 @@ void __fastcall TTerminal::CopyParallel(TParallelOperation * ParallelOperation,
   }
 }
 //---------------------------------------------------------------------------
+void __fastcall TTerminal::LogParallelTransfer(TParallelOperation * ParallelOperation)
+{
+  LogEvent(
+    FORMAT("Adding a parallel transfer to the transfer started on the connection \"%s\"",
+    (ParallelOperation->MainName)));
+}
+//---------------------------------------------------------------------------
 void __fastcall TTerminal::LogTotalTransferDetails(
   const UnicodeString TargetDir, const TCopyParamType * CopyParam,
   TFileOperationProgressType * OperationProgress, bool Parallel, TStrings * Files)
@@ -6450,7 +6458,7 @@ bool __fastcall TTerminal::CopyToRemote(TStrings * FilesToCopy,
         if (Parallel)
         {
           // OnceDoneOperation is not supported
-          ParallelOperation->Init(Files.release(), UnlockedTargetDir, CopyParam, Params, &OperationProgress);
+          ParallelOperation->Init(Files.release(), UnlockedTargetDir, CopyParam, Params, &OperationProgress, Log->Name);
           CopyParallel(ParallelOperation, &OperationProgress);
         }
         else
@@ -6578,7 +6586,7 @@ bool __fastcall TTerminal::CopyToLocal(TStrings * FilesToCopy,
           if (Parallel)
           {
             // OnceDoneOperation is not supported
-            ParallelOperation->Init(Files.release(), TargetDir, CopyParam, Params, &OperationProgress);
+            ParallelOperation->Init(Files.release(), TargetDir, CopyParam, Params, &OperationProgress, Log->Name);
             CopyParallel(ParallelOperation, &OperationProgress);
           }
           else

+ 4 - 1
source/core/Terminal.h

@@ -441,6 +441,7 @@ public:
   bool __fastcall CopyToRemote(TStrings * FilesToCopy,
     const UnicodeString TargetDir, const 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 = NULL);
   void __fastcall CreateLink(const UnicodeString FileName, const UnicodeString PointTo, bool Symbolic);
@@ -801,7 +802,7 @@ public:
 
   void Init(
     TStrings * AFiles, const UnicodeString & TargetDir, const TCopyParamType * CopyParam, int Params,
-    TFileOperationProgressType * MainOperationProgress);
+    TFileOperationProgressType * MainOperationProgress, const UnicodeString & MainName);
 
   void WaitFor();
   bool ShouldAddClient();
@@ -817,6 +818,7 @@ public:
   __property int Params = { read = FParams };
   __property UnicodeString TargetDir = { read = FTargetDir };
   __property TFileOperationProgressType * MainOperationProgress = { read = FMainOperationProgress };
+  __property UnicodeString MainName = { read = FMainName };
 
 private:
   struct TDirectoryData
@@ -837,6 +839,7 @@ private:
   std::unique_ptr<TCriticalSection> FSection;
   TFileOperationProgressType * FMainOperationProgress;
   TOperationSide FSide;
+  UnicodeString FMainName;
 
   bool CheckEnd(TCollectedFileList * Files);
 };