summaryrefslogtreecommitdiffstats
path: root/src/server/net
diff options
context:
space:
mode:
authorManuel Schneider2014-05-27 00:23:19 +0200
committerManuel Schneider2014-05-27 00:23:19 +0200
commit273550ed1696a25c135b74992240200db03d97e4 (patch)
treed24bf17b97f7a8f3e2dbe3e065d445daa1e13f64 /src/server/net
parentReplace states by two flags indicating the state (diff)
downloadpvs2-273550ed1696a25c135b74992240200db03d97e4.tar.gz
pvs2-273550ed1696a25c135b74992240200db03d97e4.tar.xz
pvs2-273550ed1696a25c135b74992240200db03d97e4.zip
Drop _desiredProjectionSource. Dont send a stopVncClient if it has not been started before.
Diffstat (limited to 'src/server/net')
-rw-r--r--src/server/net/client.cpp25
-rw-r--r--src/server/net/client.h9
2 files changed, 11 insertions, 23 deletions
diff --git a/src/server/net/client.cpp b/src/server/net/client.cpp
index 7eeb3d4..4478e28 100644
--- a/src/server/net/client.cpp
+++ b/src/server/net/client.cpp
@@ -20,7 +20,6 @@ Client::Client(QSslSocket* socket) : _socket(socket)
{
assert(socket != NULL);
_authed = 0;
- _desiredProjectionSource = 0;
_isBroadcastSource = false;
_currentProjectionSource = 0;
_vncPort = 0;
@@ -196,16 +195,12 @@ void Client::handleMsg()
if (_activeVncClient)
{
qDebug() << "Client " << _name << " started its VNC client (watching " << projectionSource << ")";
- if (projectionSource == _desiredProjectionSource)
- _desiredProjectionSource = 0;
emit vncClientStateChange(this, _currentProjectionSource);
_currentProjectionSource = projectionSource;
}
else
{
qDebug() << "Client " << _name << " stopped its VNC client (watched " << projectionSource << ")";
- if (projectionSource == _desiredProjectionSource)
- _desiredProjectionSource = 0;
emit vncClientStateChange(this, _currentProjectionSource);
_currentProjectionSource = 0;
}
@@ -311,20 +306,22 @@ void Client::startVncClient(const Client * const to)
/******************************************************************************/
void Client::stopVncClient()
{
- NetworkMessage msg;
- msg.setField(_ID, _VNCCLIENT);
- sendMessage(msg);
+ if (_currentProjectionSource != 0) {
+ NetworkMessage msg;
+ msg.setField(_ID, _VNCCLIENT);
+ sendMessage(msg);
+ }
}
/******************************************************************************/
void Client::lockScreen(bool lock)
{
- if (_isTutor)
- return;
- NetworkMessage msg;
- msg.setField(_ID, _LOCK);
- msg.setField(_ENABLE, lock ? __TRUE : __FALSE);
- sendMessage(msg);
+ if (!_isTutor){
+ NetworkMessage msg;
+ msg.setField(_ID, _LOCK);
+ msg.setField(_ENABLE, lock ? __TRUE : __FALSE);
+ sendMessage(msg);
+ }
}
/******************************************************************************/
diff --git a/src/server/net/client.h b/src/server/net/client.h
index 198b213..5623717 100644
--- a/src/server/net/client.h
+++ b/src/server/net/client.h
@@ -44,7 +44,6 @@ public:
inline const QString& host() const { return _host; }
inline const QString ip() const { return _socket->peerAddress().toString(); }
inline const int id() const { return _id; }
- inline const int desiredProjectionSource() const { return _desiredProjectionSource; }
inline const int currentProjectionSource() const { return _currentProjectionSource; }
// To be replaced by states
inline const bool isActiveVncClient() const { return _activeVncClient; }
@@ -53,15 +52,8 @@ public:
// Setters
inline void setBroadcastSource(bool enable) { _isBroadcastSource = enable; }
- inline void setDesiredProjectionSource(int source) { _desiredProjectionSource = source; }
inline void setTutor(bool enable){ _isTutor = enable; }
-
- //New ones
-//b void startVncServer();
-
-
-
//Send message stuff
void startVncServer();
void stopVncServer();
@@ -82,7 +74,6 @@ private:
NetworkMessage _fromClient;
int _timerIdAuthTimeout, _timerPingTimeout;
int _id; // this client's unique id
- int _desiredProjectionSource;
bool _isBroadcastSource; // Tells whether this client is currently the VNC broadcast source.
int _currentProjectionSource;
QString _vncRwPass, _vncRoPass;