diff options
author | Alan Conway <aconway@apache.org> | 2007-10-31 14:50:58 +0000 |
---|---|---|
committer | Alan Conway <aconway@apache.org> | 2007-10-31 14:50:58 +0000 |
commit | e7e29f238b9f1678fdf98c53e9d98b6dd77b3128 (patch) | |
tree | 35fd5377379efe170b9346dff8ac66f3d5356daa /qpid/cpp/src | |
parent | 7dad525a5c71fe346a275646945793d36adf4c9a (diff) | |
download | qpid-python-e7e29f238b9f1678fdf98c53e9d98b6dd77b3128.tar.gz |
Fix client side core dump when disconneced unexpectedly:
void qpid::client::SessionCore::invariant() const: Assertion
Minor items:
src/qpid/broker/Queue.cpp: info log for each message dispatched.
src/qpid/broker/SessionHandler.cpp: check attached in handleOut()
src/qpid/sys/Dispatcher.cpp: use polymorphic_downcast to catch cast errors in debug builds.
src/qpid/client/SessionCore.cpp: fix incorrect asserts
src/qpid/client/Message.h: convenience constructor parameters
git-svn-id: https://svn.apache.org/repos/asf/incubator/qpid/trunk@590688 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'qpid/cpp/src')
-rw-r--r-- | qpid/cpp/src/qpid/broker/Queue.cpp | 1 | ||||
-rw-r--r-- | qpid/cpp/src/qpid/broker/SessionHandler.cpp | 3 | ||||
-rw-r--r-- | qpid/cpp/src/qpid/client/Message.h | 5 | ||||
-rw-r--r-- | qpid/cpp/src/qpid/client/SessionCore.cpp | 2 | ||||
-rw-r--r-- | qpid/cpp/src/qpid/sys/Dispatcher.cpp | 5 |
5 files changed, 12 insertions, 4 deletions
diff --git a/qpid/cpp/src/qpid/broker/Queue.cpp b/qpid/cpp/src/qpid/broker/Queue.cpp index d668ee0505..44ed743880 100644 --- a/qpid/cpp/src/qpid/broker/Queue.cpp +++ b/qpid/cpp/src/qpid/broker/Queue.cpp @@ -182,6 +182,7 @@ Consumer::ptr Queue::allocate() bool Queue::dispatch(QueuedMessage& msg) { + QPID_LOG(info, "Dispatch message " << msg.position << " from queue " << name); //additions to the acquirers will result in a separate dispatch //request, so won't result in anyone being missed uint counter = getAcquirerCount(); diff --git a/qpid/cpp/src/qpid/broker/SessionHandler.cpp b/qpid/cpp/src/qpid/broker/SessionHandler.cpp index 9b065be8af..49492ffed1 100644 --- a/qpid/cpp/src/qpid/broker/SessionHandler.cpp +++ b/qpid/cpp/src/qpid/broker/SessionHandler.cpp @@ -80,6 +80,9 @@ void SessionHandler::handleIn(AMQFrame& f) { } void SessionHandler::handleOut(AMQFrame& f) { + if (!session.get()) + throw InternalErrorException( + QPID_MSG("attempt to send frame on detached channel.")); channel.handle(f); // Send it. if (session->sent(f)) peerSession.solicitAck(); diff --git a/qpid/cpp/src/qpid/client/Message.h b/qpid/cpp/src/qpid/client/Message.h index 655fc89457..b2ae273813 100644 --- a/qpid/cpp/src/qpid/client/Message.h +++ b/qpid/cpp/src/qpid/client/Message.h @@ -38,7 +38,10 @@ namespace client { class Message : public framing::TransferContent { public: - Message(const std::string& data_=std::string()) : TransferContent(data_) {} + Message(const std::string& data_=std::string(), + const std::string& routingKey=std::string(), + const std::string& exchange=std::string() + ) : TransferContent(data_, routingKey, exchange) {} std::string getDestination() const { diff --git a/qpid/cpp/src/qpid/client/SessionCore.cpp b/qpid/cpp/src/qpid/client/SessionCore.cpp index ea877f9b40..f7f0f52dba 100644 --- a/qpid/cpp/src/qpid/client/SessionCore.cpp +++ b/qpid/cpp/src/qpid/client/SessionCore.cpp @@ -62,13 +62,11 @@ inline void SessionCore::invariant() const { case CLOSING: case SUSPENDING: assert(session); - assert(code==REPLY_SUCCESS); assert(connection); assert(channel.get()); assert(channel.next == connection.get()); break; case SUSPENDED: - assert(code==REPLY_SUCCESS); assert(session); assert(!connection); break; diff --git a/qpid/cpp/src/qpid/sys/Dispatcher.cpp b/qpid/cpp/src/qpid/sys/Dispatcher.cpp index b8751168c2..d49af9d079 100644 --- a/qpid/cpp/src/qpid/sys/Dispatcher.cpp +++ b/qpid/cpp/src/qpid/sys/Dispatcher.cpp @@ -21,6 +21,8 @@ #include "Dispatcher.h" +#include <boost/cast.hpp> + #include <assert.h> namespace qpid { @@ -36,7 +38,8 @@ Dispatcher::~Dispatcher() { void Dispatcher::run() { do { Poller::Event event = poller->wait(); - DispatchHandle* h = static_cast<DispatchHandle*>(event.handle); + DispatchHandle* h = + boost::polymorphic_downcast<DispatchHandle*>(event.handle); // If can read/write then dispatch appropriate callbacks if (h) { |