summaryrefslogtreecommitdiff
path: root/cpp/src/qpidd.cpp
diff options
context:
space:
mode:
authorAlan Conway <aconway@apache.org>2008-07-04 19:07:33 +0000
committerAlan Conway <aconway@apache.org>2008-07-04 19:07:33 +0000
commitd738d179e4c040e62438516bc0992736d00b902f (patch)
tree73694d534d1fd2526dfe64b874f60944ab5a92b7 /cpp/src/qpidd.cpp
parent3a00f4fdffe6de06873e9d4d3569bb7531adda85 (diff)
downloadqpid-python-d738d179e4c040e62438516bc0992736d00b902f.tar.gz
Cluster prototype: handles client-initiated commands (not dequeues)
Details - Cluster.cpp: serializes all frames thru cluster (see below) - broker/ConnectionManager: Added handler chain in front of Connection::received. - sys::Fork and ForkWithMessage - abstractions for forking with posix impl. - tests/ForkedBroker.h: test utility to fork a broker process. - broker/SignalHandler: Encapsulated signal handling from qpidd.cpp - Various minor logging & error message improvements to aid debugging. NB: current impl will not scale. It is functional working starting point so we can start testing & profiling to find the right optimizations. git-svn-id: https://svn.apache.org/repos/asf/incubator/qpid/trunk/qpid@674107 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'cpp/src/qpidd.cpp')
-rw-r--r--cpp/src/qpidd.cpp20
1 files changed, 2 insertions, 18 deletions
diff --git a/cpp/src/qpidd.cpp b/cpp/src/qpidd.cpp
index 64e64cab38..8e1b8c3d0a 100644
--- a/cpp/src/qpidd.cpp
+++ b/cpp/src/qpidd.cpp
@@ -19,6 +19,7 @@
*
*/
#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"
@@ -131,12 +132,6 @@ struct BootstrapOptions : public qpid::Options {
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) {}
@@ -153,7 +148,6 @@ struct QpiddDaemon : public Daemon {
uint16_t port=brokerPtr->getPort();
ready(port); // Notify parent.
brokerPtr->run();
- brokerPtr.reset();
}
};
@@ -240,17 +234,7 @@ int main(int argc, char* argv[])
}
// Starting the broker.
-
- // 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);
-
+ broker::SignalHandler::setBroker(brokerPtr); // Set up signal handling.
if (options->daemon.daemon) {
// For daemon mode replace default stderr with syslog.
if (options->log.outputs.size() == 1 && options->log.outputs[0] == "stderr") {