summaryrefslogtreecommitdiff
path: root/cpp/src
diff options
context:
space:
mode:
authorGordon Sim <gsim@apache.org>2008-03-06 17:52:59 +0000
committerGordon Sim <gsim@apache.org>2008-03-06 17:52:59 +0000
commit9fd4909832e16734c47c13eebbe4aca66640b1b0 (patch)
tree6882efaaa8244086c0765f95ee1c1e9836bb088c /cpp/src
parent19ad6741d3579b1ffce70a43271e4e4f804ad643 (diff)
downloadqpid-python-9fd4909832e16734c47c13eebbe4aca66640b1b0.tar.gz
Fixes to c++ broker:
- use final version of delivery properties where appropriate - start sequence numbering of outgoing messages at 0 - explicit accept-mode is now 0 (no more confirm-mode) - add default initialisers for numeric fields in methods Converted some more python tests to use final 0-10 client. git-svn-id: https://svn.apache.org/repos/asf/incubator/qpid/trunk/qpid@634368 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'cpp/src')
-rw-r--r--cpp/src/qpid/broker/MessageAdapter.cpp8
-rw-r--r--cpp/src/qpid/broker/MessageAdapter.h3
-rw-r--r--cpp/src/qpid/broker/MessageDelivery.cpp9
-rw-r--r--cpp/src/qpid/broker/SemanticState.cpp6
-rw-r--r--cpp/src/qpid/broker/SemanticState.h2
-rw-r--r--cpp/src/qpid/broker/SessionAdapter.cpp2
-rw-r--r--cpp/src/qpid/broker/SessionState.cpp2
7 files changed, 21 insertions, 11 deletions
diff --git a/cpp/src/qpid/broker/MessageAdapter.cpp b/cpp/src/qpid/broker/MessageAdapter.cpp
index a70de72646..2515b2fff6 100644
--- a/cpp/src/qpid/broker/MessageAdapter.cpp
+++ b/cpp/src/qpid/broker/MessageAdapter.cpp
@@ -30,7 +30,7 @@ namespace broker{
std::string TransferAdapter::getRoutingKey(const framing::FrameSet& f)
{
- const framing::DeliveryProperties* p = f.getHeaders()->get<framing::DeliveryProperties>();
+ const framing::DeliveryProperties010* p = f.getHeaders()->get<framing::DeliveryProperties010>();
return p ? p->getRoutingKey() : empty;
}
@@ -61,4 +61,10 @@ namespace broker{
{
return f.as<framing::MessageTransferBody>()->getDestination();
}
+
+ std::string PreviewAdapter::getRoutingKey(const framing::FrameSet& f)
+ {
+ const framing::DeliveryProperties* p = f.getHeaders()->get<framing::DeliveryProperties>();
+ return p ? p->getRoutingKey() : empty;
+ }
}}
diff --git a/cpp/src/qpid/broker/MessageAdapter.h b/cpp/src/qpid/broker/MessageAdapter.h
index de488b295e..865d2e1685 100644
--- a/cpp/src/qpid/broker/MessageAdapter.h
+++ b/cpp/src/qpid/broker/MessageAdapter.h
@@ -48,7 +48,7 @@ struct MessageAdapter
struct TransferAdapter : MessageAdapter
{
- std::string getRoutingKey(const framing::FrameSet& f);
+ virtual std::string getRoutingKey(const framing::FrameSet& f);
virtual std::string getExchange(const framing::FrameSet& f);
bool isImmediate(const framing::FrameSet&);
const framing::FieldTable* getApplicationHeaders(const framing::FrameSet& f);
@@ -58,6 +58,7 @@ struct TransferAdapter : MessageAdapter
struct PreviewAdapter : TransferAdapter
{
std::string getExchange(const framing::FrameSet& f);
+ std::string getRoutingKey(const framing::FrameSet& f);
};
}}
diff --git a/cpp/src/qpid/broker/MessageDelivery.cpp b/cpp/src/qpid/broker/MessageDelivery.cpp
index 22053260c5..9ef7090cd9 100644
--- a/cpp/src/qpid/broker/MessageDelivery.cpp
+++ b/cpp/src/qpid/broker/MessageDelivery.cpp
@@ -90,14 +90,17 @@ struct MessageDeliveryToken : BaseToken
AMQFrame sendMethod(intrusive_ptr<Message> msg, DeliveryId /*id*/)
{
//may need to set the redelivered flag:
- if (msg->getRedelivered()){
- msg->getProperties<DeliveryProperties>()->setRedelivered(true);
- }
if (isPreview) {
+ if (msg->getRedelivered()){
+ msg->getProperties<DeliveryProperties>()->setRedelivered(true);
+ }
return AMQFrame(in_place<MessageTransferBody>(
ProtocolVersion(), 0, destination,
confirmMode, acquireMode));
} else {
+ if (msg->getRedelivered()){
+ msg->getProperties<DeliveryProperties010>()->setRedelivered(true);
+ }
return AMQFrame(in_place<Message010TransferBody>(
ProtocolVersion(), destination, confirmMode, acquireMode));
}
diff --git a/cpp/src/qpid/broker/SemanticState.cpp b/cpp/src/qpid/broker/SemanticState.cpp
index b56b152397..5851eeeafb 100644
--- a/cpp/src/qpid/broker/SemanticState.cpp
+++ b/cpp/src/qpid/broker/SemanticState.cpp
@@ -89,12 +89,12 @@ bool SemanticState::exists(const string& consumerTag){
}
void SemanticState::consume(DeliveryToken::shared_ptr token, string& tagInOut,
- Queue::shared_ptr queue, bool nolocal, bool acks, bool acquire,
- bool exclusive, const FieldTable*)
+ Queue::shared_ptr queue, bool nolocal, bool ackRequired, bool acquire,
+ bool exclusive, const FieldTable*)
{
if(tagInOut.empty())
tagInOut = tagGenerator.generate();
- std::auto_ptr<ConsumerImpl> c(new ConsumerImpl(this, token, tagInOut, queue, acks, nolocal, acquire));
+ std::auto_ptr<ConsumerImpl> c(new ConsumerImpl(this, token, tagInOut, queue, ackRequired, nolocal, acquire));
queue->consume(*c, exclusive);//may throw exception
outputTasks.addOutputTask(c.get());
consumers.insert(tagInOut, c.release());
diff --git a/cpp/src/qpid/broker/SemanticState.h b/cpp/src/qpid/broker/SemanticState.h
index 88a2fcab5c..8648135cae 100644
--- a/cpp/src/qpid/broker/SemanticState.h
+++ b/cpp/src/qpid/broker/SemanticState.h
@@ -151,7 +151,7 @@ class SemanticState : public framing::FrameHandler::Chains,
*@param tagInOut - if empty it is updated with the generated token.
*/
void consume(DeliveryToken::shared_ptr token, string& tagInOut, Queue::shared_ptr queue,
- bool nolocal, bool acks, bool acquire, bool exclusive, const framing::FieldTable* = 0);
+ bool nolocal, bool ackRequired, bool acquire, bool exclusive, const framing::FieldTable* = 0);
void cancel(const string& tag);
diff --git a/cpp/src/qpid/broker/SessionAdapter.cpp b/cpp/src/qpid/broker/SessionAdapter.cpp
index 5ab0dd84a9..c4ee6d9ec1 100644
--- a/cpp/src/qpid/broker/SessionAdapter.cpp
+++ b/cpp/src/qpid/broker/SessionAdapter.cpp
@@ -308,7 +308,7 @@ SessionAdapter::MessageHandlerImpl::subscribe(const string& queueName,
string tag = destination;
state.consume(MessageDelivery::getMessageDeliveryToken(destination, acceptMode, acquireMode),
tag, queue, false, //TODO get rid of no-local
- acceptMode == 1, acquireMode == 0, exclusive, &arguments);
+ acceptMode == 0, acquireMode == 0, exclusive, &arguments);
}
void
diff --git a/cpp/src/qpid/broker/SessionState.cpp b/cpp/src/qpid/broker/SessionState.cpp
index ceaa70db18..7d0d0dacfa 100644
--- a/cpp/src/qpid/broker/SessionState.cpp
+++ b/cpp/src/qpid/broker/SessionState.cpp
@@ -42,7 +42,7 @@ using qpid::management::Args;
SessionState::SessionState(
SessionManager* f, SessionHandler* h, uint32_t timeout_, uint32_t ack)
- : framing::SessionState(ack, timeout_ > 0),
+ : framing::SessionState(ack, timeout_ > 0), nextOut(0),
factory(f), handler(h), id(true), timeout(timeout_),
broker(h->getConnection().broker),
version(h->getConnection().getVersion()),