qpid-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From g...@apache.org
Subject svn commit: r674482 - /incubator/qpid/trunk/qpid/cpp/src/qpidd.cpp
Date Mon, 07 Jul 2008 13:15:40 GMT
Author: gsim
Date: Mon Jul  7 06:15:39 2008
New Revision: 674482

URL: http://svn.apache.org/viewvc?rev=674482&view=rev
Log:
Temporarily reverting changes to signal handling; as checked in by r674107 it prevents the
broker being shutdown.


Modified:
    incubator/qpid/trunk/qpid/cpp/src/qpidd.cpp

Modified: incubator/qpid/trunk/qpid/cpp/src/qpidd.cpp
URL: http://svn.apache.org/viewvc/incubator/qpid/trunk/qpid/cpp/src/qpidd.cpp?rev=674482&r1=674481&r2=674482&view=diff
==============================================================================
--- incubator/qpid/trunk/qpid/cpp/src/qpidd.cpp (original)
+++ incubator/qpid/trunk/qpid/cpp/src/qpidd.cpp Mon Jul  7 06:15:39 2008
@@ -19,7 +19,6 @@
  *
  */
 #include "qpid/broker/Broker.h"
-#include "qpid/broker/SignalHandler.h"
 #include "qpid/sys/posix/check.h"
 #include "qpid/broker/Daemon.h"
 #include "qpid/log/Statement.h"
@@ -132,6 +131,12 @@
 shared_ptr<Broker> brokerPtr;
 auto_ptr<QpiddOptions> options;
 
+void shutdownHandler(int /*signal*/){
+    // Note: do not call any async-signal unsafe functions here.
+    // Do any extra shutdown actions in main() after broker->run()
+    brokerPtr->shutdown();
+}
+
 struct QpiddDaemon : public Daemon {
     QpiddDaemon(std::string pidDir) : Daemon(pidDir) {}
 
@@ -148,6 +153,7 @@
         uint16_t port=brokerPtr->getPort();
         ready(port);            // Notify parent.
         brokerPtr->run();
+        brokerPtr.reset();
     }
 };
 
@@ -234,7 +240,17 @@
         }
 
         // Starting the broker.
-        broker::SignalHandler::setBroker(brokerPtr); // Set up signal handling.
+
+        // Signal handling
+        signal(SIGINT,shutdownHandler); 
+        signal(SIGTERM,shutdownHandler);
+        signal(SIGHUP,SIG_IGN); // TODO aconway 2007-07-18: reload config.
+
+        signal(SIGCHLD,SIG_IGN); 
+        signal(SIGTSTP,SIG_IGN); 
+        signal(SIGTTOU,SIG_IGN);
+        signal(SIGTTIN,SIG_IGN);
+            
         if (options->daemon.daemon) {
             // For daemon mode replace default stderr with syslog.
             if (options->log.outputs.size() == 1 && options->log.outputs[0]
== "stderr") {



Mime
View raw message