From 0c2b1dd8a5290f8b7b03a7fce77e9a57d709c7a7 Mon Sep 17 00:00:00 2001 From: Simon Rettberg Date: Mon, 8 Feb 2016 15:07:07 +0100 Subject: [client] Increase vnc client connect timeout to account for large pools of clients --- src/client/vnc/vncthread.cpp | 6 ++++-- src/client/vnc/vncthread.h | 2 +- src/client/vnc/vncwindow.cpp | 6 +++++- 3 files changed, 10 insertions(+), 4 deletions(-) diff --git a/src/client/vnc/vncthread.cpp b/src/client/vnc/vncthread.cpp index c9327ad..dfa35af 100644 --- a/src/client/vnc/vncthread.cpp +++ b/src/client/vnc/vncthread.cpp @@ -176,10 +176,12 @@ void VncThread::run() setsockopt(_client->sock, SOL_TCP, TCP_QUICKACK, &one, sizeof(one)); // Main VNC event loop - emit projectionStarted(); + if (_run) { + _connected = true; + emit projectionStarted(); + } while (_run) { - _connected = true; const int i = WaitForMessage(_client, 100 * 1000); // wait 100ms for message. returns -1 on error/disconnect, 0 if nothing happened, 1 if new data arrived if (i < 0) break; diff --git a/src/client/vnc/vncthread.h b/src/client/vnc/vncthread.h index bb1405c..a5b52b1 100644 --- a/src/client/vnc/vncthread.h +++ b/src/client/vnc/vncthread.h @@ -57,7 +57,7 @@ private: int _srcStepX, _srcStepY, _dstStepX, _dstStepY; - bool _connected; + volatile bool _connected; volatile bool _run; void calcScaling(); diff --git a/src/client/vnc/vncwindow.cpp b/src/client/vnc/vncwindow.cpp index ff7c5d4..53877e1 100644 --- a/src/client/vnc/vncwindow.cpp +++ b/src/client/vnc/vncwindow.cpp @@ -124,7 +124,7 @@ void VncWindow::open(const QString& host, int port, const QString& passwd, bool this->show(); _vncWorker->setTargetSize(this->size()); - _tcpTimeoutTimer = startTimer(4000); + _tcpTimeoutTimer = startTimer(10000); _vncWorker->start(QThread::LowPriority); } @@ -170,6 +170,10 @@ void VncWindow::onUpdateImage(const int x, const int y, const int w, const int h */ void VncWindow::onProjectionStarted() { + if (_tcpTimeoutTimer != 0) { + killTimer(_tcpTimeoutTimer); + _tcpTimeoutTimer = 0; + } emit running(true, _clientId); _redrawTimer = startTimer(3000); } -- cgit v1.2.3-55-g7522