summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGordon Sim <gsim@apache.org>2009-12-16 11:28:58 +0000
committerGordon Sim <gsim@apache.org>2009-12-16 11:28:58 +0000
commit3c177fca8789ac389e0c660220ac6b88f8b2d261 (patch)
tree02e181177b7ba7e4076e15e9b80c145f087cba73
parentb07ef1b95d1c6496697e9b9502f50deccec59ed9 (diff)
downloadqpid-python-3c177fca8789ac389e0c660220ac6b88f8b2d261.tar.gz
QPID-2278: Encode alternate exchange information at the end of the buffer for backward compatibility with stores created from older versions
git-svn-id: https://svn.apache.org/repos/asf/qpid/trunk@891195 13f79535-47bb-0310-9956-ffa450edef68
-rw-r--r--qpid/cpp/src/qpid/broker/Queue.cpp10
1 files changed, 6 insertions, 4 deletions
diff --git a/qpid/cpp/src/qpid/broker/Queue.cpp b/qpid/cpp/src/qpid/broker/Queue.cpp
index ef1adaf7ec..f4231f2397 100644
--- a/qpid/cpp/src/qpid/broker/Queue.cpp
+++ b/qpid/cpp/src/qpid/broker/Queue.cpp
@@ -940,11 +940,11 @@ void Queue::setPersistenceId(uint64_t _persistenceId) const
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 @@ Queue::shared_ptr Queue::decode ( QueueRegistry& queues, Buffer& buffer, bool re
{
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;
}