qpid-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From acon...@apache.org
Subject svn commit: r904232 - in /qpid/trunk/qpid/cpp/src/qpid: assert.cpp cluster/Event.cpp
Date Thu, 28 Jan 2010 19:42:49 GMT
Author: aconway
Date: Thu Jan 28 19:42:48 2010
New Revision: 904232

URL: http://svn.apache.org/viewvc?rev=904232&view=rev
Log:
Fixed cluster error "Not enough for multicast header"

Fixed incorrect test of message size.
Added assertions.

Modified:
    qpid/trunk/qpid/cpp/src/qpid/assert.cpp
    qpid/trunk/qpid/cpp/src/qpid/cluster/Event.cpp

Modified: qpid/trunk/qpid/cpp/src/qpid/assert.cpp
URL: http://svn.apache.org/viewvc/qpid/trunk/qpid/cpp/src/qpid/assert.cpp?rev=904232&r1=904231&r2=904232&view=diff
==============================================================================
--- qpid/trunk/qpid/cpp/src/qpid/assert.cpp (original)
+++ qpid/trunk/qpid/cpp/src/qpid/assert.cpp Thu Jan 28 19:42:48 2010
@@ -24,14 +24,16 @@
 #include <sstream>
 #include <iostream>
 #include "qpid/framing/reply_exceptions.h"
+#include "qpid/log/Statement.h"
 #include <stdlib.h>
 
 namespace qpid {
 
 void assert_fail(char const * expr, char const * function, char const * file, long line)
{
     std::ostringstream msg;
-    msg << "Internal error: " << expr << " in function " << function
+    msg << "Assertion failed: " << expr << " in function " << function
         << "(" << file << ":" << line << ")";
+    QPID_LOG(critical, msg.str());
 #ifdef NDEBUG
     throw framing::InternalErrorException(msg.str());
 #else

Modified: qpid/trunk/qpid/cpp/src/qpid/cluster/Event.cpp
URL: http://svn.apache.org/viewvc/qpid/trunk/qpid/cpp/src/qpid/cluster/Event.cpp?rev=904232&r1=904231&r2=904232&view=diff
==============================================================================
--- qpid/trunk/qpid/cpp/src/qpid/cluster/Event.cpp (original)
+++ qpid/trunk/qpid/cpp/src/qpid/cluster/Event.cpp Thu Jan 28 19:42:48 2010
@@ -51,11 +51,9 @@
 {}
 
 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 @@
 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 @@
 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;
 }



---------------------------------------------------------------------
Apache Qpid - AMQP Messaging Implementation
Project:      http://qpid.apache.org
Use/Interact: mailto:commits-subscribe@qpid.apache.org


Mime
View raw message