diff options
-rw-r--r-- | src/server/net/client.cpp | 32 | ||||
-rw-r--r-- | src/server/net/client.h | 5 |
2 files changed, 10 insertions, 27 deletions
diff --git a/src/server/net/client.cpp b/src/server/net/client.cpp index 047bd05..5283246 100644 --- a/src/server/net/client.cpp +++ b/src/server/net/client.cpp @@ -27,10 +27,14 @@ Client::Client(QSslSocket* socket) : _ip = _socket->peerAddress().toString(); qDebug("*** Client %s created.", qPrintable(_ip)); // Connect important signals - connect(_socket, SIGNAL(disconnected()), this, SLOT(onClosed())); - connect(_socket, SIGNAL(error(QAbstractSocket::SocketError)), this, SLOT(onError(QAbstractSocket::SocketError))); - connect(_socket, SIGNAL(sslErrors(const QList<QSslError> &)), this, SLOT(onSslErrors(const QList<QSslError> &))); - connect(_socket, SIGNAL(readyRead()), this, SLOT(onDataArrival())); + connect(_socket, SIGNAL(disconnected()), + this, SLOT(disconnect())); + connect(_socket, SIGNAL(error(QAbstractSocket::SocketError)), + this, SLOT(disconnect())); + connect(_socket, SIGNAL(sslErrors(const QList<QSslError> &)), + this, SLOT(disconnect())); + connect(_socket, SIGNAL(readyRead()), + this, SLOT(onDataArrival())); // Send challenge _challenge.resize(CHALLENGE_LEN); for (int i = 0; i < CHALLENGE_LEN; ++i) @@ -145,21 +149,6 @@ void Client::onDataArrival() } } -void Client::onSslErrors(const QList<QSslError> & errors) -{ - this->disconnect(); -} - -void Client::onClosed() -{ - this->disconnect(); -} - -void Client::onError(QAbstractSocket::SocketError errcode) -{ - this->disconnect(); -} - void Client::handleMsg() { _pingTimeout = QDateTime::currentMSecsSinceEpoch() + PING_TIMEOUT_MS; @@ -337,13 +326,10 @@ void Client::disconnect() { if (_timerDelete == 0) { - // Order of the follwing 3 is important - emit disconnected(); - emit vncClientStateChange(this, _currentProjectionSource); - emit vncServerStateChange(this); _timerDelete = startTimer(500); qDebug("*** Client %s disconnected.", qPrintable(_ip)); _socket->blockSignals(true); _socket->abort(); + emit disconnected(); } } diff --git a/src/server/net/client.h b/src/server/net/client.h index 32ce69f..cce653e 100644 --- a/src/server/net/client.h +++ b/src/server/net/client.h @@ -52,7 +52,6 @@ private: bool _isTutor; void handleMsg(); - void disconnect(); protected: void timerEvent(QTimerEvent* event); @@ -95,10 +94,8 @@ signals: void disconnected(); private slots: - void onSslErrors(const QList<QSslError> & errors); // triggered for errors that occur during SSL negotiation void onDataArrival(); // triggered if data is available for reading - void onClosed(); // triggered if the socket is closed - void onError(QAbstractSocket::SocketError errcode); // triggered if an error occurs on the socket + void disconnect(); }; |