浏览代码

Prevent .NET assembly from timing out during lengthy file transfers

Source commit: 3c39523f6e425c51fa67d1fb221c4c751a27e85f
Martin Prikryl 9 年之前
父节点
当前提交
b3c80033bf
共有 2 个文件被更改,包括 18 次插入5 次删除
  1. 13 5
      dotnet/Session.cs
  2. 5 0
      dotnet/internal/ExeSessionProcess.cs

+ 13 - 5
dotnet/Session.cs

@@ -1592,14 +1592,22 @@ namespace WinSCP
 
         private void ProcessOutputDataReceived(object sender, OutputDataReceivedEventArgs e)
         {
-            Logger.WriteLine("Scheduling output: [{0}]", e.Data);
-            Output.InternalAdd(e.Data);
-            if (Output.Count > 1000)
+            if (e == null)
             {
-                Output.InternalRemoveFirst();
+                Logger.WriteLine("Got incomplete progress output");
             }
+            else
+            {
+                Logger.WriteLine("Scheduling output: [{0}]", e.Data);
+                Output.InternalAdd(e.Data);
+                if (Output.Count > 1000)
+                {
+                    Output.InternalRemoveFirst();
+                }
+                ScheduleEvent(() => RaiseOutputDataReceived(e.Data));
+            }
+
             GotOutput();
-            ScheduleEvent(() => RaiseOutputDataReceived(e.Data));
         }
 
         private void ScheduleEvent(Action action)

+ 5 - 0
dotnet/internal/ExeSessionProcess.cs

@@ -364,6 +364,11 @@ namespace WinSCP
             {
                 _lastFromBeginning = message;
                 _logger.WriteLine("Buffered from-beginning message [{0}]", _lastFromBeginning);
+
+                if (OutputDataReceived != null)
+                {
+                    OutputDataReceived(this, null);
+                }
             }
             else
             {