summaryrefslogtreecommitdiff
path: root/cpp/src/qpid/broker/DtxHandlerImpl.cpp
diff options
context:
space:
mode:
authorGordon Sim <gsim@apache.org>2007-11-06 17:27:27 +0000
committerGordon Sim <gsim@apache.org>2007-11-06 17:27:27 +0000
commita2ded139f371d273afa858f49a5b7f6e0efc2394 (patch)
tree8fc04da8ffe3aa819843a101a75d98429f27eaa5 /cpp/src/qpid/broker/DtxHandlerImpl.cpp
parenta1a0ecfbf02293cf917db5e56d65d367be5ad5a7 (diff)
downloadqpid-python-a2ded139f371d273afa858f49a5b7f6e0efc2394.tar.gz
Add support for array type to c++ (and python, decode only for now)
Change the type of the in-doubt field in dtx-coordination.recover to an array (to bring in line with amqp spec) git-svn-id: https://svn.apache.org/repos/asf/incubator/qpid/trunk/qpid@592494 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'cpp/src/qpid/broker/DtxHandlerImpl.cpp')
-rw-r--r--cpp/src/qpid/broker/DtxHandlerImpl.cpp22
1 files changed, 6 insertions, 16 deletions
diff --git a/cpp/src/qpid/broker/DtxHandlerImpl.cpp b/cpp/src/qpid/broker/DtxHandlerImpl.cpp
index ec042ff56a..533872e849 100644
--- a/cpp/src/qpid/broker/DtxHandlerImpl.cpp
+++ b/cpp/src/qpid/broker/DtxHandlerImpl.cpp
@@ -20,6 +20,7 @@
#include <boost/format.hpp>
#include "Broker.h"
#include "qpid/framing/constants.h"
+#include "qpid/framing/Array.h"
using namespace qpid::broker;
using namespace qpid::framing;
@@ -136,25 +137,14 @@ DtxCoordinationRecoverResult DtxHandlerImpl::recover(u_int16_t /*ticket*/,
// strictly 'legal', but that is ok for testing
std::set<std::string> xids;
getBroker().getStore().collectPreparedXids(xids);
- uint size(0);
- for (std::set<std::string>::iterator i = xids.begin(); i != xids.end(); i++) {
- size += i->size() + 1/*shortstr size*/;
- }
- char* bytes = static_cast<char*>(::alloca(size + 4/*longstr size*/));
- Buffer wbuffer(bytes, size + 4/*longstr size*/);
- wbuffer.putLong(size);
+ //TODO: remove the need to copy from one container type to another
+ std::vector<std::string> data;
for (std::set<std::string>::iterator i = xids.begin(); i != xids.end(); i++) {
- wbuffer.putShortString(*i);
+ data.push_back(*i);
}
-
- Buffer rbuffer(bytes, size + 4/*longstr size*/);
- string data;
- rbuffer.getLongString(data);
-
- FieldTable response;
- response.setString("xids", data);
- return DtxCoordinationRecoverResult(response);
+ Array indoubt(data);
+ return DtxCoordinationRecoverResult(indoubt);
}
void DtxHandlerImpl::forget(u_int16_t /*ticket*/,