From 11e18ee79b54cb2bd9d95af785be3270931ff0d9 Mon Sep 17 00:00:00 2001 From: Manuel Schneider Date: Wed, 28 May 2014 17:22:14 +0200 Subject: Try to reconnect if the pvsmgr gets disconnected --- src/client/connectwindow/connectwindow.cpp | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) (limited to 'src/client/connectwindow/connectwindow.cpp') diff --git a/src/client/connectwindow/connectwindow.cpp b/src/client/connectwindow/connectwindow.cpp index 34087ad..7f24281 100644 --- a/src/client/connectwindow/connectwindow.cpp +++ b/src/client/connectwindow/connectwindow.cpp @@ -164,7 +164,7 @@ void ConnectWindow::connectToSession(const QByteArray sessionName) return; _state = Scanning; this->updateState(); - _serverDiscovery.start(_ui->lineEditName->text().toUtf8()); + _serverDiscovery.start(sessionName); } /* @@ -189,6 +189,7 @@ void ConnectWindow::onBtnConnection() if (_connected || _state != Idle) { + _tryReconnect = false; // Stop or disconnect emit disconnect(); _state = Idle; @@ -197,6 +198,7 @@ void ConnectWindow::onBtnConnection() else { // Connect (scan for session) + _tryReconnect = true; connectToSession(_ui->lineEditName->text().toUtf8()); } } @@ -233,6 +235,7 @@ void ConnectWindow::onServerDetected(const QString& host, const quint16 port, co */ void ConnectWindow::onConnectionStateChange(ConnectWindow::ConnectionState state) { + qDebug() << "STATE!"<< state; bool reset = (_state == Scanning); if (state == InvalidSslHash) ++_hashSslErrorCount; @@ -240,8 +243,10 @@ void ConnectWindow::onConnectionStateChange(ConnectWindow::ConnectionState state _state = state; this->updateState(); - if (reset) + if (reset) { + qDebug() << "RESET!!"<< state; _state = Scanning; + } if (state == Connected) { QObject::disconnect(_connection, SIGNAL(stateChange(ConnectWindow::ConnectionState)), this, SLOT(onConnectionStateChange(ConnectWindow::ConnectionState))); @@ -271,5 +276,8 @@ void ConnectWindow::onConnectionClosed(QObject* connection) void ConnectWindow::onConnectionDisconnected() { _connected = false; + _state = Idle; this->updateState(); + if (_tryReconnect) + connectToSession(_ui->lineEditName->text().toUtf8()); } -- cgit v1.2.3-55-g7522