summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorManuel Schneider2014-07-21 23:37:48 +0200
committerManuel Schneider2014-07-21 23:37:48 +0200
commitda49924c228ea71abd3f71fa94737953dd763b53 (patch)
tree9efd598e15925d8f1b84c05627815b48ea6cd0ec /src
parentRename modes. Move code in slots to avoid unnecessary branching. Give the cli... (diff)
downloadpvs2-da49924c228ea71abd3f71fa94737953dd763b53.tar.gz
pvs2-da49924c228ea71abd3f71fa94737953dd763b53.tar.xz
pvs2-da49924c228ea71abd3f71fa94737953dd763b53.zip
Finally implemented one click projectionsource change
Prevent the new projectionsource from beeing killed by stop clients wrt the connections
Diffstat (limited to 'src')
-rw-r--r--src/server/mainwindow/mainwindow.cpp47
1 files changed, 29 insertions, 18 deletions
diff --git a/src/server/mainwindow/mainwindow.cpp b/src/server/mainwindow/mainwindow.cpp
index c78f8de..9dee65b 100644
--- a/src/server/mainwindow/mainwindow.cpp
+++ b/src/server/mainwindow/mainwindow.cpp
@@ -1117,29 +1117,40 @@ void MainWindow::onVncServerStateChange(Client* client)
*/
void MainWindow::onVncClientStateChange(Client* client)
{
- if (client != NULL)
+ if (client != NULL)
{
// VNC Client stopped -> remove from watchers
- if (!client->isActiveVncClient()){
- // _watchers.remove(client->id());
+ if (!client->isActiveVncClient()){
if (getClientFromId(client->id()) != NULL)
getClientFromId(client->id())->setWatcher(false);
- // If noboody is watching the multicast stop VNC server
- bool noWatchers = true;
- for (QList<ConnectionFrame*>::iterator it(_clientFrames.begin()); it != _clientFrames.end(); ++it)
- {
- if ((*it)->client() != NULL)
- {
- if ((*it)->client()->isWatcher())
- noWatchers = false;
- }
- }
- if (noWatchers && _mode != Mode::Broadcast)
- {
- Client* c = getClientFromId(_streamingSource);
- if (c != NULL)
- c->stopVncServer();
+ /*
+ * If noboody 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
+ * 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;
+ }
+ }
+ if (noWatchers && _mode != Mode::Broadcast)
+ {
+ Client* c = getClientFromId(_streamingSource);
+ if (c != NULL)
+ c->stopVncServer();
+ }
}
}
}