summaryrefslogtreecommitdiffstats
path: root/src/server/mainwindow/mainwindow.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/server/mainwindow/mainwindow.cpp')
-rw-r--r--src/server/mainwindow/mainwindow.cpp22
1 files changed, 12 insertions, 10 deletions
diff --git a/src/server/mainwindow/mainwindow.cpp b/src/server/mainwindow/mainwindow.cpp
index e4958b0..11071f6 100644
--- a/src/server/mainwindow/mainwindow.cpp
+++ b/src/server/mainwindow/mainwindow.cpp
@@ -479,22 +479,24 @@ void MainWindow::multicast(Client *from, Client *to, bool blockOthers)
_mode = blockOthers ? Mode::LockedMulticast : Mode::Multicast;
}
+ // If already watching drop it
+ if (_watchers.contains(to->id()))
+ _watchers.remove(to->id());
+ else // List "to" as watcher
+ _watchers.insert(to->id(), to);
+
// if there is a server running which is not "from" stop it.
if (_streamingSource != NULL && _streamingSource != from)
_streamingSource->stopVncServer();
- _streamingSource = from;
- _watchers.insert(to->id(), to);
+ // Set new streaming source
+ _streamingSource = from;
- if (from->isActiveVncServer()) // From is already active
- this->onVncServerStateChange(from);
+ // If streaming source is already active avoid a restart
+ if (_streamingSource->isActiveVncServer())
+ this->onVncServerStateChange(_streamingSource);
else // Could not take shortcut, (re)start VNC server on source
- from->startVncServer();
-
- if (blockOthers){
- // TODO: REDESIGN TO FIT THE REQUIREMENTS
- }
-
+ _streamingSource->startVncServer();
}
/***************************************************************************//**