This is an automated email from the git hooks/post-receive script. x2go pushed a commit to branch master in repository x2goclient. commit a775155acafda1d996fa6c10cf07c901561414a9 Author: Oleksandr Shneyder <o.shneyder@phoca-gmbh.de> Date: Wed Aug 22 14:48:39 2018 +0200 Broker can send to client command to suspend or terminate the session as an answer to the client event message. For this broker should send to client SUSPEND ID or TERMINATE ID. --- debian/changelog | 3 +++ src/httpbrokerclient.cpp | 12 ++++++++++++ src/onmainwindow.cpp | 21 +++++++++++++++++++++ src/onmainwindow.h | 2 ++ 4 files changed, 38 insertions(+) diff --git a/debian/changelog b/debian/changelog index cdb3712..dc01147 100644 --- a/debian/changelog +++ b/debian/changelog @@ -14,6 +14,9 @@ x2goclient (4.1.2.2-0x2go1) UNRELEASED; urgency=medium ALIVE events. To do this, broker should send config option "liveevent" (int). It means, if liveevent=10, client will send ALIVE event to broker every 10 seconds when the client connected to X2Go Session. + - Broker can send to client command to suspend or terminate the session as an + answer to the client event message. For this broker should send to client + SUSPEND ID or TERMINATE ID. [ Mihai Moldovan ] * New upstream version (4.1.2.2): diff --git a/src/httpbrokerclient.cpp b/src/httpbrokerclient.cpp index b12961f..6110866 100644 --- a/src/httpbrokerclient.cpp +++ b/src/httpbrokerclient.cpp @@ -408,6 +408,18 @@ void HttpBrokerClient::slotEventSent(bool success, QString answer, int) if(!checkAccess(answer)) return; x2goDebug<<"event sent:"<<answer; + if(answer.indexOf("SUSPEND")!=-1) + { + QString sid=answer.split("SUSPEND ")[1].simplified(); + x2goDebug<<"broker asks to suspend "<<sid; + mainWindow->suspendFromBroker(sid); + } + if(answer.indexOf("TERMINATE")!=-1) + { + QString sid=answer.split("TERMINATE ")[1].simplified(); + x2goDebug<<"broker asks to terminate "<<sid; + mainWindow->terminateFromBroker(sid); + } } diff --git a/src/onmainwindow.cpp b/src/onmainwindow.cpp index e5a9855..8aa5078 100644 --- a/src/onmainwindow.cpp +++ b/src/onmainwindow.cpp @@ -5028,6 +5028,27 @@ void ONMainWindow::slotResumeSess() } +void ONMainWindow::suspendFromBroker(const QString& sid) +{ + if(proxyRunning && sid ==resumingSession.sessionId) + { + x2goDebug<<"Suspending session from broker"; + sendEventToBroker(SUSPENDING); + suspendSession(sid); + } +} + + +void ONMainWindow::terminateFromBroker(const QString& sid) +{ + if(proxyRunning && sid ==resumingSession.sessionId) + { + x2goDebug<<"Suspending session from broker"; + sendEventToBroker(TERMINATING); + termSession(sid,false); + } +} + void ONMainWindow::slotSuspendSess() { diff --git a/src/onmainwindow.h b/src/onmainwindow.h index 3996e43..3fa35dd 100644 --- a/src/onmainwindow.h +++ b/src/onmainwindow.h @@ -914,6 +914,8 @@ private: bool trayMaxDiscon; bool trayAutoHidden; void sendEventToBroker(client_events ev); + void suspendFromBroker(const QString& sid); + void terminateFromBroker(const QString& sid); QString findSshKeyForServer(QString user, QString server, QString port); void loadSettings(); void showPass ( UserButton* user ); -- Alioth's /home/x2go-admin/maintenancescripts/git/hooks/post-receive-email on /srv/git/code.x2go.org/x2goclient.git