Ver Fonte

Improved connection time for fast connections

(slowness caused by Bug 757)

Source commit: da4d517019946b42baf3b10bf9de7911368af303
Martin Prikryl há 9 anos atrás
pai
commit
dd29d48f46
1 ficheiros alterados com 5 adições e 1 exclusões
  1. 5 1
      source/core/Queue.cpp

+ 5 - 1
source/core/Queue.cpp

@@ -2198,10 +2198,12 @@ void __fastcall TTerminalThread::RunAction(TNotifyEvent Action)
       TriggerEvent();
 
       bool Done = false;
+      const unsigned int MaxWait = 50;
+      unsigned int Wait = MaxWait;
 
       do
       {
-        switch (WaitForSingleObject(FActionEvent, 50))
+        switch (WaitForSingleObject(FActionEvent, Wait))
         {
           case WAIT_OBJECT_0:
             Done = true;
@@ -2221,6 +2223,7 @@ void __fastcall TTerminalThread::RunAction(TNotifyEvent Action)
 
               FUserAction = NULL;
               TriggerEvent();
+              Wait = 0;
             }
             else
             {
@@ -2228,6 +2231,7 @@ void __fastcall TTerminalThread::RunAction(TNotifyEvent Action)
               {
                 FOnIdle(NULL);
               }
+              Wait = std::min(Wait + 10, MaxWait);
             }
             break;