2121
2222#include " FTPWindow.h"
2323
24- void CALLBACK FTPSessionTimerProc (PVOID lpHandle, BOOLEAN TimerOrWaitFired) {
24+ void CALLBACK FTPSessionTimerProc (PVOID lpHandle, BOOLEAN /* TimerOrWaitFired*/ ) {
2525 FTPSession* obj = (FTPSession*) lpHandle;
2626 obj->QueueTimerHandler ();
2727}
@@ -66,7 +66,6 @@ int FTPSession::Init(FTPWindow * ftpWindow, FTPSettings * ftpSettings) {
6666 m_isInit = true ;
6767
6868 m_timerHandle = NULL ;
69- m_timerCount = 0 ;
7069 m_timerIsInit = false ;
7170
7271 return 0 ;
@@ -143,7 +142,6 @@ int FTPSession::TerminateSession() {
143142 if (m_timerIsInit) {
144143 OutDebug (" [FTPSession] Deleting session timer" );
145144 DeleteTimerQueueTimer (NULL , m_timerHandle, NULL );
146- m_timerCount = 0 ;
147145 OutDebug (" [FTPSession] Successfully deleted session timer" );
148146
149147 m_timerIsInit = false ;
@@ -163,7 +161,7 @@ int FTPSession::TerminateSession() {
163161 return 0 ;
164162}
165163
166- bool FTPSession::IsConnected () {
164+ bool FTPSession::IsConnected () const {
167165 return m_running;
168166}
169167
@@ -192,8 +190,8 @@ int FTPSession::Connect() {
192190 NULL ,
193191 (WAITORTIMERCALLBACK ) FTPSessionTimerProc,
194192 this ,
195- 0 ,
196- (m_currentProfile->GetNoOp () * 1000 ) + 500 ,
193+ (m_currentProfile-> GetNoOp () * 1000 ) + 2000 ,
194+ (m_currentProfile->GetNoOp () * 1000 ) + 1000 ,
197195 WT_EXECUTEINTIMERTHREAD
198196 );
199197
@@ -209,28 +207,21 @@ int FTPSession::Connect() {
209207
210208
211209void FTPSession::QueueTimerHandler () {
212- // don't call on first immediate run
213- if (m_timerCount++ == 0 ) {
214- return ;
215- }
216-
210+
217211 // don't call if last action has been recently run
218212 DWORD mainSecs = m_mainWrapper->LastAction ();
219213 DWORD transSecs = m_transferWrapper->LastAction ();
220-
214+
221215 if (mainSecs == 0 && transSecs == 0 ) {
222216 OutDebug (" [FTPSession] Both main/trans wrappers report 0 seconds since last action" );
223217 return ;
224218 }
225-
226- DWORD minSecs = mainSecs;
227- if (transSecs < mainSecs) {
228- minSecs = transSecs;
229- }
230-
219+
220+ DWORD minSecs = min (mainSecs, transSecs);
221+
231222 OutDebug (" [FTPSession] There has been %d seconds since last action with server" , minSecs);
232-
233- if (minSecs > (DWORD ) m_currentProfile->GetNoOp ()) {
223+
224+ if (minSecs >= (DWORD ) m_currentProfile->GetNoOp ()) {
234225 OutDebug (" [FTPSession] Running NOOP" );
235226 NoOp ();
236227 }
0 commit comments