瀏覽代碼

Bug 1600: Session hangs when QueryReceived is set while session is already opened

https://winscp.net/tracker/1600

Source commit: 9448b6e94d48209e2e78ce141773df7ba9d873a9
Martin Prikryl 7 年之前
父節點
當前提交
50bb35b01a
共有 1 個文件被更改,包括 11 次插入4 次删除
  1. 11 4
      dotnet/Session.cs

+ 11 - 4
dotnet/Session.cs

@@ -127,6 +127,7 @@ namespace WinSCP
                 if (Opened && send)
                 {
                     SendOptionBatchCommand();
+                    WaitForGroup();
                 }
             }
         }
@@ -141,6 +142,7 @@ namespace WinSCP
                     if (Opened && (_queryReceived == null))
                     {
                         SendOptionBatchCommand();
+                        WaitForGroup();
                     }
                 }
             }
@@ -324,10 +326,7 @@ namespace WinSCP
                     _reader = new SessionElementLogReader(_logReader);
 
                     // Skip "open" command <group>
-                    using (ElementLogReader groupReader = _reader.WaitForGroupAndCreateLogReader())
-                    {
-                        ReadElement(groupReader, LogReadFlags.ThrowFailures);
-                    }
+                    WaitForGroup();
 
                     WriteCommand("pwd");
 
@@ -362,6 +361,14 @@ namespace WinSCP
             WriteCommand(command);
         }
 
+        private void WaitForGroup()
+        {
+            using (ElementLogReader groupReader = _reader.WaitForGroupAndCreateLogReader())
+            {
+                ReadElement(groupReader, LogReadFlags.ThrowFailures);
+            }
+        }
+
         internal string GetErrorOutputMessage()
         {
             string result = null;