From 234ec4b758bac2a371a62ee34274e9278fb95511 Mon Sep 17 00:00:00 2001 From: Manuel Schneider Date: Tue, 27 May 2014 14:06:49 +0200 Subject: Make it possible to exclude a client from multicast. --- src/server/mainwindow/mainwindow.cpp | 22 ++++++++++++---------- 1 file changed, 12 insertions(+), 10 deletions(-) (limited to 'src/server/mainwindow/mainwindow.cpp') 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(); } /***************************************************************************//** -- cgit v1.2.3-55-g7522