diff options
author | Alan Conway <aconway@apache.org> | 2010-01-28 19:42:48 +0000 |
---|---|---|
committer | Alan Conway <aconway@apache.org> | 2010-01-28 19:42:48 +0000 |
commit | 6502cce999a8276679e6a74049f739483a3fe7dd (patch) | |
tree | 46570bd6c1a1ef43f93a4e9248eb4d89c84a19d1 /cpp/src/qpid/cluster/Event.cpp | |
parent | fe2db915235fdca1c8ed2335e69127b43ee5b835 (diff) | |
download | qpid-python-6502cce999a8276679e6a74049f739483a3fe7dd.tar.gz |
Fixed cluster error "Not enough for multicast header"
Fixed incorrect test of message size.
Added assertions.
git-svn-id: https://svn.apache.org/repos/asf/qpid/trunk/qpid@904232 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'cpp/src/qpid/cluster/Event.cpp')
-rw-r--r-- | cpp/src/qpid/cluster/Event.cpp | 13 |
1 files changed, 5 insertions, 8 deletions
diff --git a/cpp/src/qpid/cluster/Event.cpp b/cpp/src/qpid/cluster/Event.cpp index 52564990f6..cd775ce2f1 100644 --- a/cpp/src/qpid/cluster/Event.cpp +++ b/cpp/src/qpid/cluster/Event.cpp @@ -51,11 +51,9 @@ Event::Event(EventType t, const ConnectionId& c, size_t s) {} void EventHeader::decode(const MemberId& m, framing::Buffer& buf) { - if (buf.available() <= HEADER_SIZE) - throw Exception("Not enough for multicast header"); + QPID_ASSERT(buf.available() >= HEADER_SIZE); type = (EventType)buf.getOctet(); - if(type != DATA && type != CONTROL) - throw Exception("Invalid multicast event type"); + QPID_ASSERT(type == DATA || type == CONTROL); connectionId = ConnectionId(m, buf.getLongLong()); size = buf.getLong(); } @@ -63,8 +61,7 @@ void EventHeader::decode(const MemberId& m, framing::Buffer& buf) { Event Event::decodeCopy(const MemberId& m, framing::Buffer& buf) { Event e; e.decode(m, buf); // Header - if (buf.available() < e.size) - throw Exception("Not enough data for multicast event"); + QPID_ASSERT(buf.available() >= e.size); e.store = RefCountedBuffer::create(e.size + HEADER_SIZE); memcpy(e.getData(), buf.getPointer() + buf.getPosition(), e.size); return e; @@ -107,8 +104,8 @@ Event::operator Buffer() const { const AMQFrame& Event::getFrame() const { assert(type == CONTROL); if (!frame.getBody()) { - Buffer buf(*this); - QPID_ASSERT(frame.decode(buf)); + Buffer buf(*this); + QPID_ASSERT(frame.decode(buf)); } return frame; } |