From 9e5d9dc04b5162a014e5ae342c6e1ac6321a570e Mon Sep 17 00:00:00 2001 From: Steffen Ritter Date: Tue, 12 Jun 2018 13:39:49 +0200 Subject: [server] Handle client disconnects --- src/server/mainwindow/mainwindow.cpp | 15 +++++---------- src/server/mainwindow/mainwindow.h | 3 +-- 2 files changed, 6 insertions(+), 12 deletions(-) diff --git a/src/server/mainwindow/mainwindow.cpp b/src/server/mainwindow/mainwindow.cpp index d4819cf..cb3ef86 100644 --- a/src/server/mainwindow/mainwindow.cpp +++ b/src/server/mainwindow/mainwindow.cpp @@ -1148,6 +1148,7 @@ void MainWindow::onClientAuthenticated(Client* client) connect(client, SIGNAL(vncServerStateChange(Client*)), this, SLOT(onVncServerStateChange(Client*))); connect(client, SIGNAL(vncClientStateChange(Client*)), this, SLOT(onVncClientStateChange(Client*))); ConnectionFrame *existing = NULL; + ConnectionFrame *cf = NULL; for (QList::iterator it(_clientFrames.begin()); it != _clientFrames.end(); ++it) { // qDebug() << "Existing frame ip: " << (*it)->computerId(); // qDebug() << "New Clients ip: " << client->ip(); @@ -1159,22 +1160,16 @@ void MainWindow::onClientAuthenticated(Client* client) // Clients ip already exists, but was not active. if (existing != NULL) { - // qDebug() << "Should go into this if clause."; - existing->assignClient(client); - tellClientCurrentSituation(client); - clientCountChanged(); - return; + cf = existing; + } else { + cf = createFrame(); } - // New one, create - ConnectionFrame *cf = createFrame(); - // Assign client instance cf->assignClient(client); - + connect(client, SIGNAL(disconnected()), this, SLOT(clientCountChanged())); //resizeEvent(NULL); // This is where all the positioning should be tellClientCurrentSituation(client); clientCountChanged(); - } /***************************************************************************//** diff --git a/src/server/mainwindow/mainwindow.h b/src/server/mainwindow/mainwindow.h index 6a0db89..a07e710 100644 --- a/src/server/mainwindow/mainwindow.h +++ b/src/server/mainwindow/mainwindow.h @@ -103,11 +103,10 @@ private: void reloadCurrentRoom(); - void clientCountChanged(); - protected slots: void DisableButtons(); void EnableButtons(); + void clientCountChanged(); void onSessionNameClick(); void onSessionNameUpdate(); -- cgit v1.2.3-55-g7522