diff options
author | Charles E. Rolke <chug@apache.org> | 2013-04-24 14:40:17 +0000 |
---|---|---|
committer | Charles E. Rolke <chug@apache.org> | 2013-04-24 14:40:17 +0000 |
commit | d77618749507b8e5df3bc5c96f64e3d644f862fe (patch) | |
tree | d62db5687672df59ae5e4205987abc076824ffd2 | |
parent | 77179da3f70ec38c849be4e1c0736e124743e810 (diff) | |
download | qpid-python-d77618749507b8e5df3bc5c96f64e3d644f862fe.tar.gz |
QPID-4758: Extend the qpidd --wait option to work at shutdown
Patch from Ernie Allen and Pavel Moravec.
Note: This patch is for the posix platform broker; The windows broker does not use a --wait option and is unaffected by this patch.
git-svn-id: https://svn.apache.org/repos/asf/qpid/trunk@1471442 13f79535-47bb-0310-9956-ffa450edef68
-rw-r--r-- | qpid/cpp/src/posix/QpiddBroker.cpp | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/qpid/cpp/src/posix/QpiddBroker.cpp b/qpid/cpp/src/posix/QpiddBroker.cpp index dc6766d34f..1968cbb588 100644 --- a/qpid/cpp/src/posix/QpiddBroker.cpp +++ b/qpid/cpp/src/posix/QpiddBroker.cpp @@ -78,7 +78,7 @@ struct DaemonOptions : public qpid::Options { ("daemon,d", pure_switch(daemon), "Run as a daemon. Logs to syslog by default in this mode.") ("transport", optValue(transport, "TRANSPORT"), "The transport for which to return the port") ("pid-dir", optValue(piddir, "DIR"), "Directory where port-specific PID file is stored") - ("wait,w", optValue(wait, "SECONDS"), "Sets the maximum wait time to initialize the daemon. If the daemon fails to initialize, prints an error and returns 1") + ("wait,w", optValue(wait, "SECONDS"), "Sets the maximum wait time to initialize or shutdown the daemon. If the daemon fails to initialize/shutdown, prints an error and returns 1") ("check,c", pure_switch(check), "Prints the daemon's process ID to stdout and returns 0 if the daemon is running, otherwise returns 1") ("quit,q", pure_switch(quit), "Tells the daemon to shut down"); } @@ -174,7 +174,7 @@ int QpiddBroker::execute (QpiddOptions *options) { if (kill(pid, SIGINT) < 0) throw Exception("Failed to stop daemon: " + qpid::sys::strError(errno)); // Wait for the process to die before returning - int retry=10000; // Try up to 10 seconds + int retry=myOptions->daemon.wait*1000; // Try up to "--wait N" seconds, do retry every millisecond while (kill(pid,0) == 0 && --retry) sys::usleep(1000); if (retry == 0) |