[X2go-Commits] x2godesktopsharing.git - master (branch) updated: 3.0.1.2-23-g0d49dfd

X2go dev team git-admin at x2go.org
Wed Sep 28 17:52:11 CEST 2011


The branch, master has been updated
       via  0d49dfdde6ee62e21c709de027a6f80576d88727 (commit)
      from  ae952c3ad02ebd5231b425cfcc13c8a6515c01d8 (commit)

Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.

- Log -----------------------------------------------------------------
commit 0d49dfdde6ee62e21c709de027a6f80576d88727
Author: Mike Gabriel <mike.gabriel at das-netzwerkteam.de>
Date:   Wed Sep 28 17:52:08 2011 +0200

    Also catch SIGHUP signals.

-----------------------------------------------------------------------

Summary of changes:
 main.cpp      |    9 ++++++++-
 sharetray.cpp |   24 ++++++++++++++++++++++++
 sharetray.h   |    4 ++++
 3 files changed, 36 insertions(+), 1 deletions(-)

The diff of changes is:
diff --git a/main.cpp b/main.cpp
index b435d48..be7bb9b 100644
--- a/main.cpp
+++ b/main.cpp
@@ -83,7 +83,7 @@ void  client ( const QStringList & cmd )
 
 static int setup_unix_signal_handlers()
 {
-	struct sigaction keybint, term, abort;
+	struct sigaction keybint, term, abort, hup;
 
 	keybint.sa_handler = ShareTray::keybintSignalHandler;
 	sigemptyset(&keybint.sa_mask);
@@ -107,6 +107,13 @@ static int setup_unix_signal_handlers()
 	if (sigaction(SIGABRT, &abort, 0) > 0)
 	return 3;
 
+	hup.sa_handler = ShareTray::hupSignalHandler;
+	sigemptyset(&hup.sa_mask);
+	hup.sa_flags |= SA_RESTART;
+
+	if (sigaction(SIGHUP, &hup, 0) > 0)
+	return 4;
+
 	return 0;
 }
 
diff --git a/sharetray.cpp b/sharetray.cpp
index 7c00b1e..2bf7dee 100644
--- a/sharetray.cpp
+++ b/sharetray.cpp
@@ -41,6 +41,7 @@
 int ShareTray::sigkeybintFd[2];
 int ShareTray::sigtermFd[2];
 int ShareTray::sigabortFd[2];
+int ShareTray::sighupFd[2];
 
 ShareTray::ShareTray()
         : QMainWindow()
@@ -181,12 +182,17 @@ ShareTray::ShareTray()
 	if (::socketpair(AF_UNIX, SOCK_STREAM, 0, sigabortFd))
 		qFatal("Couldn't create ABRT socketpair");
 
+	if (::socketpair(AF_UNIX, SOCK_STREAM, 0, sighupFd))
+		qFatal("Couldn't create HANGUP socketpair");
+
 	snKeybInt = new QSocketNotifier(sigkeybintFd[1], QSocketNotifier::Read, this);
 	connect(snKeybInt, SIGNAL(activated(int)), this, SLOT(handleSigKeybInt()));
 	snTerm = new QSocketNotifier(sigtermFd[1], QSocketNotifier::Read, this);
 	connect(snTerm, SIGNAL(activated(int)), this, SLOT(handleSigTerm()));
 	snAbort = new QSocketNotifier(sigabortFd[1], QSocketNotifier::Read, this);
 	connect(snAbort, SIGNAL(activated(int)), this, SLOT(handleSigAbort()));
+	snHup = new QSocketNotifier(sighupFd[1], QSocketNotifier::Read, this);
+	connect(snHup, SIGNAL(activated(int)), this, SLOT(handleSigHup()));
 
 	QTimer *timer = new QTimer ( this );
 	connect ( timer, SIGNAL ( timeout() ), this, SLOT ( slotTimer() ) );
@@ -244,6 +250,18 @@ void ShareTray::handleSigAbort()
 	snAbort->setEnabled(true);
 }
 
+void ShareTray::handleSigHup()
+{
+	snHup->setEnabled(false);
+	char tmp;
+	::read(sighupFd[1], &tmp, sizeof(tmp));
+
+	// do Qt stuff here
+	slotMenuClose();
+
+	snHup->setEnabled(true);
+}
+
 void ShareTray::keybintSignalHandler(int)
 {
 	char a = 1;
@@ -262,6 +280,12 @@ void ShareTray::abortSignalHandler(int)
 	::write(sigabortFd[0], &a, sizeof(a));
 }
 
+void ShareTray::hupSignalHandler(int)
+{
+	char a = 1;
+	::write(sighupFd[0], &a, sizeof(a));
+}
+
 void ShareTray::slotStopSharing()
 {
 	if ( serverSocket )
diff --git a/sharetray.h b/sharetray.h
index c7fe8eb..0441359 100644
--- a/sharetray.h
+++ b/sharetray.h
@@ -37,6 +37,7 @@ public:
 	static void keybintSignalHandler(int unused);
 	static void termSignalHandler(int unused);
 	static void abortSignalHandler(int unused);
+	static void hupSignalHandler(int unused);
 	// desktop sharing socket
 	QString getSocketAnswer(QString message);
 	void closeSocket(SimpleLocalSocket* sock);
@@ -67,6 +68,7 @@ public slots:
 	void handleSigKeybInt();
 	void handleSigTerm();
 	void handleSigAbort();
+	void handleSigHup();
 private slots:
 	void slotStopSharing();
 	void slotStartSharing();
@@ -94,9 +96,11 @@ private:
 	static int sigkeybintFd[2];
 	static int sigtermFd[2];
 	static int sigabortFd[2];
+	static int sighupFd[2];
 	QSocketNotifier *snKeybInt;
 	QSocketNotifier *snTerm;
 	QSocketNotifier *snAbort;
+	QSocketNotifier *snHup;
 };
 
 #endif


hooks/post-receive
-- 
x2godesktopsharing.git (Desktop Sharing for X2go)

This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "x2godesktopsharing.git" (Desktop Sharing for X2go).




More information about the x2go-commits mailing list