diff options
author | Manuel Schneider | 2014-07-22 15:08:15 +0200 |
---|---|---|
committer | Manuel Schneider | 2014-07-22 15:08:15 +0200 |
commit | 93b74ed3d0a56374d2976f9c08785faace6bcd15 (patch) | |
tree | 7eed726163a39b85a40a8b707a761abcd36bbe81 /src/server/mainwindow/mainwindow.cpp | |
parent | Bugfix: One click source change now fully supported (diff) | |
download | pvs2-93b74ed3d0a56374d2976f9c08785faace6bcd15.tar.gz pvs2-93b74ed3d0a56374d2976f9c08785faace6bcd15.tar.xz pvs2-93b74ed3d0a56374d2976f9c08785faace6bcd15.zip |
Drop the watchers concept, since the desiredProjectionSource essentially implies it
Diffstat (limited to 'src/server/mainwindow/mainwindow.cpp')
-rw-r--r-- | src/server/mainwindow/mainwindow.cpp | 46 |
1 files changed, 22 insertions, 24 deletions
diff --git a/src/server/mainwindow/mainwindow.cpp b/src/server/mainwindow/mainwindow.cpp index ab94535..1425640 100644 --- a/src/server/mainwindow/mainwindow.cpp +++ b/src/server/mainwindow/mainwindow.cpp @@ -711,7 +711,7 @@ void MainWindow::onButtonTutorToStudent() } // If "to" already watches "from" stop it - if (getSelectedFrame()->client()->isWatcher()) + if (getSelectedFrame()->client()->desiredProjectionSource() == getTutorFrame()->client()->id() ) { getSelectedFrame()->client()->setDesiredProjectionSource(NO_SOURCE); } @@ -1115,36 +1115,34 @@ void MainWindow::onVncClientStateChange(Client* client) if (client != NULL) { // VNC Client stopped -> remove from watchers - if (!client->isActiveVncClient()){ - // client->setDesiredProjectionSource(NO_SOURCE); + if (!client->isActiveVncClient()) + { + // Only unset a desired Projection source if it has not changed meanwhile + if (client->projectionSource() == client->desiredProjectionSource()) + client->setDesiredProjectionSource(NO_SOURCE); /* - * If nobody is watching the multicast stop VNC server - * If the past connection of this client is not the current - * _streamingSource then the manager has to have stopped it - * already. This is necessary for the race condition when a server + * If nobody is watching the VNC server of the pvsclient that + * stopped its vncclient stop it. (The _LAST_ vncserver, there + * may be a new one) + * This is necessary for the race condition when a server * is stopped and another started at the same time, since the new * server would be killed if all client disconnect before any of * the new connect. */ - if (client->projectionSource() == _streamingSource) - { - bool noWatchers = true; - for (QList<ConnectionFrame*>::iterator it(_clientFrames.begin()); - it != _clientFrames.end(); ++it) - { - if ((*it)->client() != NULL) - { - if ((*it)->client()->isWatcher()) - noWatchers = false; + bool serverHasWatchers = false; + for (QList<ConnectionFrame*>::iterator it(_clientFrames.begin()); it != _clientFrames.end(); ++it) + if ((*it)->client() != NULL) + if ((*it)->client()->desiredProjectionSource() == client->projectionSource()) { + serverHasWatchers = true; + break; } - } - if (noWatchers && _mode != Mode::Broadcast) - { - Client* c = getClientFromId(_streamingSource); - if (c != NULL) - c->stopVncServer(); - } + + if ( !(serverHasWatchers || _mode == Mode::Broadcast) ) + { + Client* c = getClientFromId(client->projectionSource()); + if (c != NULL) + c->stopVncServer(); } } } |