Author: gsim
Date: Wed Dec 16 11:28:58 2009
New Revision: 891195

URL: http://svn.apache.org/viewvc?rev=891195&view=rev
Log:
QPID-2278: Encode alternate exchange information at the end of the buffer for 
backward compatibility with stores created from older versions

Modified:
    qpid/trunk/qpid/cpp/src/qpid/broker/Queue.cpp

Modified: qpid/trunk/qpid/cpp/src/qpid/broker/Queue.cpp
URL: 
http://svn.apache.org/viewvc/qpid/trunk/qpid/cpp/src/qpid/broker/Queue.cpp?rev=891195&r1=891194&r2=891195&view=diff
==============================================================================
--- qpid/trunk/qpid/cpp/src/qpid/broker/Queue.cpp (original)
+++ qpid/trunk/qpid/cpp/src/qpid/broker/Queue.cpp Wed Dec 16 11:28:58 2009
@@ -940,11 +940,11 @@
 void Queue::encode(Buffer& buffer) const 
 {
     buffer.putShortString(name);
-    buffer.putShortString(alternateExchange.get() ? 
alternateExchange->getName() : std::string(""));
     buffer.put(settings);
     if (policy.get()) { 
         buffer.put(*policy);
     }
+    buffer.putShortString(alternateExchange.get() ? 
alternateExchange->getName() : std::string(""));
 }
 
 uint32_t Queue::encodedSize() const
@@ -959,15 +959,17 @@
 {
     string name;
     buffer.getShortString(name);
-    string altExch;
-    buffer.getShortString(altExch);
     std::pair<Queue::shared_ptr, bool> result = queues.declare(name, true);
-    result.first->alternateExchangeName.assign(altExch);
     buffer.get(result.first->settings);
     result.first->configure(result.first->settings, recovering );
     if (result.first->policy.get() && buffer.available() >= 
result.first->policy->encodedSize()) {
         buffer.get ( *(result.first->policy) );
     }
+    if (buffer.available()) {
+        string altExch;
+        buffer.getShortString(altExch);
+        result.first->alternateExchangeName.assign(altExch);
+    }
 
     return result.first;
 }



---------------------------------------------------------------------
Apache Qpid - AMQP Messaging Implementation
Project:      http://qpid.apache.org
Use/Interact: mailto:[email protected]

Reply via email to