diff options
Diffstat (limited to 'cpp/src/qpid/cluster/Event.cpp')
-rw-r--r-- | cpp/src/qpid/cluster/Event.cpp | 18 |
1 files changed, 14 insertions, 4 deletions
diff --git a/cpp/src/qpid/cluster/Event.cpp b/cpp/src/qpid/cluster/Event.cpp index 52ea84b02b..ae62994e88 100644 --- a/cpp/src/qpid/cluster/Event.cpp +++ b/cpp/src/qpid/cluster/Event.cpp @@ -113,11 +113,12 @@ Event::operator Buffer() const { return Buffer(const_cast<char*>(getData()), getSize()); } -AMQFrame Event::getFrame() const { +const AMQFrame& Event::getFrame() const { assert(type == CONTROL); + if (!frame.getBody()) { Buffer buf(*this); - AMQFrame frame; QPID_ASSERT(frame.decode(buf)); + } return frame; } @@ -128,8 +129,17 @@ std::ostream& operator << (std::ostream& o, EventType t) { } std::ostream& operator << (std::ostream& o, const EventHeader& e) { - o << "Event[" << e.getConnectionId() << " " << e.getType() << " " << e.getSize() << " bytes]"; - return o; + return o << "Event[" << e.getConnectionId() << " " << e.getType() + << " " << e.getSize() << " bytes]"; +} + +std::ostream& operator << (std::ostream& o, const Event& e) { + o << "Event[" << e.getConnectionId() << " "; + if (e.getType() == CONTROL) + o << e.getFrame(); + else + o << " data " << e.getSize() << " bytes"; + return o << "]"; } }} // namespace qpid::cluster |