summaryrefslogtreecommitdiffstats
path: root/src/client/net/serverconnection.cpp
diff options
context:
space:
mode:
authorSimon Rettberg2014-04-18 20:07:14 +0200
committerSimon Rettberg2014-04-18 20:07:14 +0200
commit5542a2b5a1c36411fdaa4137a439234c4a4c003e (patch)
treec1d8d7840b492dffab173257ec28d196041e2741 /src/client/net/serverconnection.cpp
parentMerge branch 'master' (diff)
downloadpvs2-5542a2b5a1c36411fdaa4137a439234c4a4c003e.tar.gz
pvs2-5542a2b5a1c36411fdaa4137a439234c4a4c003e.tar.xz
pvs2-5542a2b5a1c36411fdaa4137a439234c4a4c003e.zip
Fix comments, add (very few) documentation comments
Diffstat (limited to 'src/client/net/serverconnection.cpp')
-rw-r--r--src/client/net/serverconnection.cpp31
1 files changed, 28 insertions, 3 deletions
diff --git a/src/client/net/serverconnection.cpp b/src/client/net/serverconnection.cpp
index 6f7f22a..530701d 100644
--- a/src/client/net/serverconnection.cpp
+++ b/src/client/net/serverconnection.cpp
@@ -53,6 +53,9 @@ ServerConnection::~ServerConnection()
_blank = NULL;
}
+/**
+ * Send the given message to the server.
+ */
void ServerConnection::sendMessage(NetworkMessage& message)
{
if (_socket == NULL || _socket->state() != QAbstractSocket::ConnectedState)
@@ -64,7 +67,11 @@ void ServerConnection::sendMessage(NetworkMessage& message)
}
}
-
+/**
+ * Disconnect from current server.
+ * Do some cleanup also, like stopping any VNC server/client
+ * activity, then finally close the connection.
+ */
void ServerConnection::disconnectFromServer()
{
if (_timerDelete == 0)
@@ -82,6 +89,11 @@ void ServerConnection::disconnectFromServer()
}
}
+/**
+ * Handles an incoming message by the server.
+ * This is somewhat of a long mess, maybe split this up some day or
+ * make it OOP with a huge amount fancy features.
+ */
void ServerConnection::handleMsg()
{
_lastData = QDateTime::currentMSecsSinceEpoch() + PING_TIMEOUT_MS;
@@ -245,7 +257,7 @@ void ServerConnection::handleMsg()
}
}
-/**
+/*
* Override
*/
@@ -283,10 +295,15 @@ void ServerConnection::timerEvent(QTimerEvent *event)
killTimer(event->timerId());
}
-/**
+/*
* Slots
*/
+/**
+ * This slot is triggered by the vnc server runner once the external VNC
+ * server was succesfully started, or was terminated (either planned or
+ * crashed).
+ */
void ServerConnection::onVncServerStartStop(int port, QString& ropass, QString& rwpass)
{
_toServer.reset();
@@ -304,6 +321,10 @@ void ServerConnection::onVncServerStartStop(int port, QString& ropass, QString&
sendMessage(_toServer);
}
+/**
+ * This slot is triggered once the internal VNC viewer has started or stopped
+ * displaying a VNC stream. We'll inform the server about the state change.
+ */
void ServerConnection::onVncViewerStartStop(const bool started, const int clientId)
{
_toServer.reset();
@@ -316,6 +337,10 @@ void ServerConnection::onVncViewerStartStop(const bool started, const int client
sendMessage(_toServer);
}
+/**
+ * An ssl error happened. If it's an expected one, we ignore it
+ * and keep going. Otherwise the connection will be terminated.
+ */
void ServerConnection::sslErrors(const QList<QSslError> & errors)
{
for (QList<QSslError>::const_iterator it = errors.begin(); it != errors.end(); it++)