فهرست منبع

Do not wait for server to respond to EOF indefinitely (related to bdf994a7)

Source commit: 92761fe51d5cde0bfebe659d321a244cdb070fe8
Martin Prikryl 6 سال پیش
والد
کامیت
0a584ec344
1فایلهای تغییر یافته به همراه8 افزوده شده و 3 حذف شده
  1. 8 3
      source/core/SecureShell.cpp

+ 8 - 3
source/core/SecureShell.cpp

@@ -1707,10 +1707,15 @@ void __fastcall TSecureShell::Close()
     // this is particularly necessary when using local proxy command
     // (e.g. plink), otherwise it hangs in sk_localproxy_close
     SendSpecial(SS_EOF);
-    // Wait for the EOF exchange to complete (among other to avoid packet queue memory leaks)
-    while (backend_exitcode(FBackendHandle) < 0)
+    // Try waiting for the EOF exchange to complete (among other to avoid packet queue memory leaks)
+    int Timeout = 500;
+    while ((backend_exitcode(FBackendHandle) < 0) && (Timeout > 0))
     {
-      EventSelectLoop(100, false, NULL);
+      const int Step = 100;
+      if (!EventSelectLoop(Step, false, NULL))
+      {
+        Timeout -= Step;
+      }
     }
   }