qpid-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From g...@apache.org
Subject svn commit: r1414714 - in /qpid/branches/0.20/qpid/cpp/src/qpid/broker: Protocol.cpp SemanticState.cpp amqp_0_10/MessageTransfer.cpp amqp_0_10/MessageTransfer.h
Date Wed, 28 Nov 2012 14:14:22 GMT
Author: gsim
Date: Wed Nov 28 14:14:21 2012
New Revision: 1414714

URL: http://svn.apache.org/viewvc?rev=1414714&view=rev
Log:
QPID-4448: fix credit checking on 0-10 path when message is of 1.0 format

Modified:
    qpid/branches/0.20/qpid/cpp/src/qpid/broker/Protocol.cpp
    qpid/branches/0.20/qpid/cpp/src/qpid/broker/SemanticState.cpp
    qpid/branches/0.20/qpid/cpp/src/qpid/broker/amqp_0_10/MessageTransfer.cpp
    qpid/branches/0.20/qpid/cpp/src/qpid/broker/amqp_0_10/MessageTransfer.h

Modified: qpid/branches/0.20/qpid/cpp/src/qpid/broker/Protocol.cpp
URL: http://svn.apache.org/viewvc/qpid/branches/0.20/qpid/cpp/src/qpid/broker/Protocol.cpp?rev=1414714&r1=1414713&r2=1414714&view=diff
==============================================================================
--- qpid/branches/0.20/qpid/cpp/src/qpid/broker/Protocol.cpp (original)
+++ qpid/branches/0.20/qpid/cpp/src/qpid/broker/Protocol.cpp Wed Nov 28 14:14:21 2012
@@ -42,6 +42,7 @@ boost::intrusive_ptr<const qpid::broker:
     for (Protocols::const_iterator i = protocols.begin(); !transfer && i != protocols.end();
++i) {
         transfer = i->second->translate(m);
     }
+    if (!transfer) throw new Exception("Could not convert message into 0-10");
     return transfer;
 }
 boost::shared_ptr<RecoverableMessage> ProtocolRegistry::recover(qpid::framing::Buffer&
b)

Modified: qpid/branches/0.20/qpid/cpp/src/qpid/broker/SemanticState.cpp
URL: http://svn.apache.org/viewvc/qpid/branches/0.20/qpid/cpp/src/qpid/broker/SemanticState.cpp?rev=1414714&r1=1414713&r2=1414714&view=diff
==============================================================================
--- qpid/branches/0.20/qpid/cpp/src/qpid/broker/SemanticState.cpp (original)
+++ qpid/branches/0.20/qpid/cpp/src/qpid/broker/SemanticState.cpp Wed Nov 28 14:14:21 2012
@@ -398,7 +398,8 @@ ostream& operator<<(ostream& o, const Co
 void SemanticState::ConsumerImpl::allocateCredit(const Message& msg)
 {
     Credit original = credit;
-    credit.consume(1, qpid::broker::amqp_0_10::MessageTransfer::getRequiredCredit(msg));
+    boost::intrusive_ptr<const amqp_0_10::MessageTransfer> transfer = protocols.translate(msg);
+    credit.consume(1, transfer->getRequiredCredit());
     QPID_LOG(debug, "Credit allocated for " << ConsumerName(*this)
              << ", was " << original << " now " << credit);
 
@@ -406,9 +407,10 @@ void SemanticState::ConsumerImpl::alloca
 
 bool SemanticState::ConsumerImpl::checkCredit(const Message& msg)
 {
-    bool enoughCredit = credit.check(1, qpid::broker::amqp_0_10::MessageTransfer::getRequiredCredit(msg));
+    boost::intrusive_ptr<const amqp_0_10::MessageTransfer> transfer = protocols.translate(msg);
+    bool enoughCredit = credit.check(1, transfer->getRequiredCredit());
     QPID_LOG(debug, "Subscription " << ConsumerName(*this) << " has " <<
(enoughCredit ? "sufficient " : "insufficient")
-             <<  " credit for message of " << qpid::broker::amqp_0_10::MessageTransfer::getRequiredCredit(msg)
<< " bytes: "
+             <<  " credit for message of " << transfer->getRequiredCredit()
<< " bytes: "
              << credit);
     return enoughCredit;
 }

Modified: qpid/branches/0.20/qpid/cpp/src/qpid/broker/amqp_0_10/MessageTransfer.cpp
URL: http://svn.apache.org/viewvc/qpid/branches/0.20/qpid/cpp/src/qpid/broker/amqp_0_10/MessageTransfer.cpp?rev=1414714&r1=1414713&r2=1414714&view=diff
==============================================================================
--- qpid/branches/0.20/qpid/cpp/src/qpid/broker/amqp_0_10/MessageTransfer.cpp (original)
+++ qpid/branches/0.20/qpid/cpp/src/qpid/broker/amqp_0_10/MessageTransfer.cpp Wed Nov 28 14:14:21
2012
@@ -116,11 +116,6 @@ void MessageTransfer::computeRequiredCre
     requiredCredit = sum.getSize();
     cachedRequiredCredit = true;
 }
-uint32_t MessageTransfer::getRequiredCredit(const qpid::broker::Message& msg)
-{
-    //TODO: may need to reflect annotations and other modifications in this also
-    return get(msg).getRequiredCredit();
-}
 
 qpid::framing::FrameSet& MessageTransfer::getFrames()
 {

Modified: qpid/branches/0.20/qpid/cpp/src/qpid/broker/amqp_0_10/MessageTransfer.h
URL: http://svn.apache.org/viewvc/qpid/branches/0.20/qpid/cpp/src/qpid/broker/amqp_0_10/MessageTransfer.h?rev=1414714&r1=1414713&r2=1414714&view=diff
==============================================================================
--- qpid/branches/0.20/qpid/cpp/src/qpid/broker/amqp_0_10/MessageTransfer.h (original)
+++ qpid/branches/0.20/qpid/cpp/src/qpid/broker/amqp_0_10/MessageTransfer.h Wed Nov 28 14:14:21
2012
@@ -109,7 +109,6 @@ class MessageTransfer : public qpid::bro
     QPID_BROKER_EXTERN bool isLastQMFResponse(const std::string correlation) const;
 
     static bool isImmediateDeliveryRequired(const qpid::broker::Message& message);
-    static uint32_t getRequiredCredit(const qpid::broker::Message&);
     static MessageTransfer& get(qpid::broker::Message& message) {
         return *dynamic_cast<MessageTransfer*>(&message.getEncoding());
     }



---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@qpid.apache.org
For additional commands, e-mail: commits-help@qpid.apache.org


Mime
View raw message