summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/server/mainwindow/mainwindow.cpp22
-rw-r--r--src/server/mainwindow/mainwindow.h1
-rw-r--r--src/server/net/client.cpp17
-rw-r--r--src/server/net/client.h2
4 files changed, 20 insertions, 22 deletions
diff --git a/src/server/mainwindow/mainwindow.cpp b/src/server/mainwindow/mainwindow.cpp
index 4af9fe1..5063df6 100644
--- a/src/server/mainwindow/mainwindow.cpp
+++ b/src/server/mainwindow/mainwindow.cpp
@@ -274,21 +274,6 @@ void MainWindow::tellClientCurrentSituation(Client* client)
}
/***************************************************************************//**
- * Checks if client and manager runs on same machine.
- * @param client
- * @return Return true, if pvsmanager is running on client.
- */
-bool MainWindow::isManagerMachine(Client* client)
-{
- foreach (const QHostAddress &address, QNetworkInterface::allAddresses())
- if (address != QHostAddress(QHostAddress::LocalHost)
- && client != NULL
- && client->ip() == address.toString())
- return true;
- return false;
-}
-
-/***************************************************************************//**
* Returns connected client which belongs to given id.
* Iterating over ConnectionFrames and comparing id to given id.
* @param id
@@ -719,9 +704,7 @@ void MainWindow::onButtonLock(bool checked)
for (QList<ConnectionFrame*>::iterator it(_clientFrames.begin()); it != _clientFrames.end(); ++it)
{
- // Check if client is Tutor or the manager is also running on this machine.
- bool isManager = isManagerMachine((*it)->client());
- if ((*it)->client() == NULL || isManager)
+ if ((*it)->client() == NULL)
continue;
(*it)->client()->lockScreen(checked);
}
@@ -972,8 +955,7 @@ void MainWindow::onVncServerStateChange(Client* client)
else
{
// Lock others and stop their clients
- bool isManager = isManagerMachine((*it)->client());
- (*it)->client()->lockScreen(_mode == Mode::LockedMulticast && isManager != true);
+ (*it)->client()->lockScreen(_mode == Mode::LockedMulticast);
(*it)->client()->stopVncClient();
}
}
diff --git a/src/server/mainwindow/mainwindow.h b/src/server/mainwindow/mainwindow.h
index dbef1b1..851dc84 100644
--- a/src/server/mainwindow/mainwindow.h
+++ b/src/server/mainwindow/mainwindow.h
@@ -76,7 +76,6 @@ private:
void savePosition(ConnectionFrame *cf);
void changeProjection(Client *from, Mode mode = Mode::Broadcast, Client *to = NULL);
void tellClientCurrentSituation(Client* client);
- bool isManagerMachine(Client* client);
void reset();
void closeEvent(QCloseEvent *e);
diff --git a/src/server/net/client.cpp b/src/server/net/client.cpp
index 135157c..584b254 100644
--- a/src/server/net/client.cpp
+++ b/src/server/net/client.cpp
@@ -11,6 +11,7 @@
#include "../../shared/util.h"
#include <QPixmap>
#include <cassert>
+#include <QNetworkInterface>
#define CHALLENGE_LEN 20
@@ -310,10 +311,24 @@ void Client::stopVncClient()
}
}
+/***************************************************************************//**
+ * Checks if client and manager runs on same machine.
+ * @return Return true, if pvsmanager is running on client.
+ */
+bool Client::isManagerMachine()
+{
+ foreach (const QHostAddress &address, QNetworkInterface::allAddresses())
+ if (address != QHostAddress(QHostAddress::LocalHost)
+ && this != NULL
+ && this->ip() == address.toString())
+ return true;
+ return false;
+}
+
/******************************************************************************/
void Client::lockScreen(bool lock)
{
- if (!_isTutor && _locked != lock){
+ if (!_isTutor && _locked != lock && !isManagerMachine()){
_locked = lock;
NetworkMessage msg;
msg.setField(_ID, _LOCK);
diff --git a/src/server/net/client.h b/src/server/net/client.h
index 1031838..6872959 100644
--- a/src/server/net/client.h
+++ b/src/server/net/client.h
@@ -71,6 +71,8 @@ private:
static int _clientIdCounter;
+ bool isManagerMachine();
+
void handleMsg();
void sendMessage(NetworkMessage& message);