Browse Source

Bug fix: FTP keepalive command was sometime sent right after the transfer finished

Source commit: 0f4782a29cf140b4c80f6c0430d4831958a864ec
Martin Prikryl 4 years ago
parent
commit
76d5949248
1 changed files with 9 additions and 2 deletions
  1. 9 2
      source/filezilla/FtpControlSocket.cpp

+ 9 - 2
source/filezilla/FtpControlSocket.cpp

@@ -1606,9 +1606,16 @@ void CFtpControlSocket::CheckForTimeout()
   int delay=GetOptionVal(OPTION_TIMEOUTLENGTH);
   if (m_pTransferSocket)
   {
-    int res=m_pTransferSocket->CheckForTimeout(delay);
-    if (res)
+    int res = m_pTransferSocket->CheckForTimeout(delay);
+    if (res != 0)
+    {
+      if (res == 1)
+      {
+        // avoid trying to set keepalive command right after the transfer finishes
+        m_LastSendTime = CTime::GetCurrentTime();
+      }
       return;
+    }
   }
   CTimeSpan span=CTime::GetCurrentTime()-m_LastRecvTime;
   if (span.GetTotalSeconds()>=delay)