浏览代码

Removing legacy fallback code from 628b4ef037 (Bug 1287: Not re-reading XML log when end of the file is reached to optimize performance.)

Source commit: b44a134c9755e40a921677bee239461304106c9e
Martin Prikryl 8 年之前
父节点
当前提交
a47d7ea444
共有 1 个文件被更改,包括 11 次插入29 次删除
  1. 11 29
      dotnet/internal/SessionLogReader.cs

+ 11 - 29
dotnet/internal/SessionLogReader.cs

@@ -121,37 +121,19 @@ namespace WinSCP
                 {
                     Cleanup();
 
-                    // We hope this code is not needed anymore.
-                    // keeping it just in case the XmlLogReader by passes
-                    // our override of PatientFileStream.Read using other read method.
-#if !DEBUG
-                    if (!_closed)
+                    // check if the the root cause was session abort
+                    Session.CheckForTimeout();
+                    LogContents();
+                    string message = "Error parsing session log file";
+                    // This is possibly a race condition, as we may not have processed the event with the error yet
+                    // The ExeSessionProcess loops every 100ms
+                    Thread.Sleep(200);
+                    string s = Session.GetErrorOutputMessage();
+                    if (!string.IsNullOrEmpty(s))
                     {
-                        // If log was not closed, it is likely the XML is not well-formed
-                        // (at least top-level <session/> tag is not closed),
-                        // so we swallow the parsing errors here.
-                        Session.Logger.WriteLine("Error parsing session log file, but it is not closed yet, will retry");
-                        Session.Logger.WriteException(e);
-                        Session.CheckForTimeout();
-                        result = false;
-                    }
-                    else
-#endif
-                    {
-                        // check if the the root cause was session abort
-                        Session.CheckForTimeout();
-                        LogContents();
-                        string message = "Error parsing session log file";
-                        // This is possibly a race condition, as we may not have processed the event with the error yet
-                        // The ExeSessionProcess loops every 100ms
-                        Thread.Sleep(200);
-                        string s = Session.GetErrorOutputMessage();
-                        if (!string.IsNullOrEmpty(s))
-                        {
-                            message += " - " + s;
-                        }
-                        throw Session.Logger.WriteException(new SessionLocalException(Session, message, e));
+                        message += " - " + s;
                     }
+                    throw Session.Logger.WriteException(new SessionLocalException(Session, message, e));
                 }
 
                 if (!result && !_closed)