浏览代码

Reseting timer variables on SSH client

Mihawk 12 年之前
父节点
当前提交
0fee9884b3
共有 1 个文件被更改,包括 4 次插入0 次删除
  1. 4 0
      SshClient.cpp

+ 4 - 0
SshClient.cpp

@@ -96,6 +96,7 @@ void SshClient::ping()
 void SshClient::pong()
 {
   killTimer(myPingTimerID);
+  myPingTimerID = -1;
   myPongTimerID = startTimer(30000);
 }
 
@@ -136,6 +137,7 @@ void SshClient::parse(const QDateTime &time, const QString &command, const QStri
     ping();
     myConnectedFlag = true;
     killTimer(myConnectionTimerID);
+    myConnectionTimerID = -1;
     emit connected();
     return;
   }
@@ -292,6 +294,7 @@ void SshClient::disconnectFromHost()
   killTimer(myConnectionTimerID);
   killTimer(myPingTimerID);
   killTimer(myPongTimerID);
+  myConnectionTimerID = myPingTimerID = myPongTimerID = -1;
 
   myProcess->terminate();
   myProcess->waitForFinished();
@@ -321,6 +324,7 @@ void SshClient::timerEvent(QTimerEvent *e)
   if(e->timerId() == myPongTimerID)
   {
     killTimer(myPongTimerID);
+    myPongTimerID = -1;
     ping();
     return;
   }