From 7cebcbdcc8cd641faa82d2eb89ecc723cc21a21b Mon Sep 17 00:00:00 2001 From: Kim van der Riet Date: Tue, 19 Jul 2011 19:57:06 +0000 Subject: QPID-3304: Patch from Gordon Sim plus tests which detect the condition being solved. Added a make check-long target to the Makefile in the cpp dir to make it easier to run the long tests. git-svn-id: https://svn.apache.org/repos/asf/qpid/trunk/qpid@1148503 13f79535-47bb-0310-9956-ffa450edef68 --- cpp/src/qpid/cluster/UpdateClient.cpp | 16 ++++++++-------- cpp/src/qpid/cluster/UpdateExchange.cpp | 8 ++++---- 2 files changed, 12 insertions(+), 12 deletions(-) (limited to 'cpp/src/qpid/cluster') diff --git a/cpp/src/qpid/cluster/UpdateClient.cpp b/cpp/src/qpid/cluster/UpdateClient.cpp index afe5b8ac3a..f306517d37 100644 --- a/cpp/src/qpid/cluster/UpdateClient.cpp +++ b/cpp/src/qpid/cluster/UpdateClient.cpp @@ -318,22 +318,22 @@ class MessageUpdater { lastPos = message.position; // if the ttl > 0, we need to send the calculated expiration time to the updatee - if (message.payload->getProperties()->getTtl() > 0) { + const DeliveryProperties* dprops = + message.payload->getProperties(); + if (dprops && dprops->getTtl() > 0) { bool hadMessageProps = message.payload->hasProperties(); - framing::MessageProperties* mprops = + const framing::MessageProperties* mprops = message.payload->getProperties(); bool hadApplicationHeaders = mprops->hasApplicationHeaders(); - FieldTable& applicationHeaders = mprops->getApplicationHeaders(); - applicationHeaders.setInt64( - UpdateClient::X_QPID_EXPIRATION, - sys::Duration(sys::EPOCH, message.payload->getExpiration())); + message.payload->insertCustomProperty(UpdateClient::X_QPID_EXPIRATION, + sys::Duration(sys::EPOCH, message.payload->getExpiration())); // If message properties or application headers didn't exist // prior to us adding data, we want to remove them on the other side. if (!hadMessageProps) - applicationHeaders.setInt(UpdateClient::X_QPID_NO_MESSAGE_PROPS, 0); + message.payload->insertCustomProperty(UpdateClient::X_QPID_NO_MESSAGE_PROPS, 0); else if (!hadApplicationHeaders) - applicationHeaders.setInt(UpdateClient::X_QPID_NO_HEADERS, 0); + message.payload->insertCustomProperty(UpdateClient::X_QPID_NO_HEADERS, 0); } // We can't send a broker::Message via the normal client API, diff --git a/cpp/src/qpid/cluster/UpdateExchange.cpp b/cpp/src/qpid/cluster/UpdateExchange.cpp index e830459aba..cb1376004e 100644 --- a/cpp/src/qpid/cluster/UpdateExchange.cpp +++ b/cpp/src/qpid/cluster/UpdateExchange.cpp @@ -49,18 +49,18 @@ void UpdateExchange::setProperties(const boost::intrusive_ptr& // Copy expiration from x-property if present. if (msg->hasProperties()) { - MessageProperties* mprops = msg->getProperties(); + const MessageProperties* mprops = msg->getProperties(); if (mprops->hasApplicationHeaders()) { - FieldTable& headers = mprops->getApplicationHeaders(); + const FieldTable& headers = mprops->getApplicationHeaders(); if (headers.isSet(UpdateClient::X_QPID_EXPIRATION)) { msg->setExpiration( sys::AbsTime(sys::EPOCH, headers.getAsInt64(UpdateClient::X_QPID_EXPIRATION))); - headers.erase(UpdateClient::X_QPID_EXPIRATION); + msg->removeCustomProperty(UpdateClient::X_QPID_EXPIRATION); // Erase props/headers that were added by the UpdateClient if (headers.isSet(UpdateClient::X_QPID_NO_MESSAGE_PROPS)) msg->eraseProperties(); else if (headers.isSet(UpdateClient::X_QPID_NO_HEADERS)) - mprops->clearApplicationHeadersFlag(); + msg->clearApplicationHeadersFlag(); } } } -- cgit v1.2.1