summaryrefslogtreecommitdiffstats
path: root/src/client
diff options
context:
space:
mode:
authorManuel Schneider2014-05-28 17:22:14 +0200
committerManuel Schneider2014-05-28 17:22:14 +0200
commit11e18ee79b54cb2bd9d95af785be3270931ff0d9 (patch)
treea851e427ab0065e167d945905cb5cc8a6f2612e6 /src/client
parentIncrease timeout for debugging (diff)
downloadpvs2-11e18ee79b54cb2bd9d95af785be3270931ff0d9.tar.gz
pvs2-11e18ee79b54cb2bd9d95af785be3270931ff0d9.tar.xz
pvs2-11e18ee79b54cb2bd9d95af785be3270931ff0d9.zip
Try to reconnect if the pvsmgr gets disconnected
Diffstat (limited to 'src/client')
-rw-r--r--src/client/connectwindow/connectwindow.cpp12
-rw-r--r--src/client/connectwindow/connectwindow.h2
-rw-r--r--src/client/net/serverdiscovery.cpp2
3 files changed, 12 insertions, 4 deletions
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());
}
diff --git a/src/client/connectwindow/connectwindow.h b/src/client/connectwindow/connectwindow.h
index 39eac86..df112fe 100644
--- a/src/client/connectwindow/connectwindow.h
+++ b/src/client/connectwindow/connectwindow.h
@@ -64,7 +64,7 @@ private:
ConnectionState _state;
QByteArray _sessionNameBytes;
NetworkMessage _packet;
- bool _connected;
+ bool _connected, _tryReconnect;
int _timerHide;
void updateState();
diff --git a/src/client/net/serverdiscovery.cpp b/src/client/net/serverdiscovery.cpp
index 9f1991c..a4edb46 100644
--- a/src/client/net/serverdiscovery.cpp
+++ b/src/client/net/serverdiscovery.cpp
@@ -47,7 +47,7 @@ ServerDiscovery::~ServerDiscovery()
*/
void ServerDiscovery::start(const QByteArray& sessionName)
{
- assert(!this->isActive());
+ //assert(!this->isActive());
// Set the session which is searched
_nameBytes = sessionName;