summaryrefslogtreecommitdiff
path: root/cpp/src
diff options
context:
space:
mode:
authorAlan Conway <aconway@apache.org>2012-01-18 22:08:53 +0000
committerAlan Conway <aconway@apache.org>2012-01-18 22:08:53 +0000
commitb5c926711d6ebc66a82acf9e4b0db3689178b73c (patch)
treeb99072f68420f3d9191e6702d4e7d84c4219a2b3 /cpp/src
parent604582905ab607be1fa5b43130426bb31faaad55 (diff)
downloadqpid-python-b5c926711d6ebc66a82acf9e4b0db3689178b73c.tar.gz
QPID-3603: Merge SemanticState unsubscribe with cancel.
Simplyfig the code, there is no need for these to be separate functions. git-svn-id: https://svn.apache.org/repos/asf/qpid/trunk/qpid@1233087 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'cpp/src')
-rw-r--r--cpp/src/qpid/broker/Consumer.h1
-rw-r--r--cpp/src/qpid/broker/SemanticState.cpp13
-rw-r--r--cpp/src/qpid/broker/SemanticState.h2
-rw-r--r--cpp/src/tests/QueueTest.cpp1
4 files changed, 8 insertions, 9 deletions
diff --git a/cpp/src/qpid/broker/Consumer.h b/cpp/src/qpid/broker/Consumer.h
index 74052844c9..647f082e44 100644
--- a/cpp/src/qpid/broker/Consumer.h
+++ b/cpp/src/qpid/broker/Consumer.h
@@ -57,6 +57,7 @@ class Consumer {
virtual bool filter(boost::intrusive_ptr<Message>) { return true; }
virtual bool accept(boost::intrusive_ptr<Message>) { return true; }
virtual OwnershipToken* getSession() = 0;
+ virtual void cancel() = 0;
protected:
framing::SequenceNumber position;
diff --git a/cpp/src/qpid/broker/SemanticState.cpp b/cpp/src/qpid/broker/SemanticState.cpp
index 0956501e76..2b9fd247f5 100644
--- a/cpp/src/qpid/broker/SemanticState.cpp
+++ b/cpp/src/qpid/broker/SemanticState.cpp
@@ -93,7 +93,7 @@ void SemanticState::closed() {
//now unsubscribe, which may trigger queue deletion and thus
//needs to occur after the requeueing of unacked messages
for (ConsumerImplMap::iterator i = consumers.begin(); i != consumers.end(); i++) {
- unsubscribe(i->second);
+ cancel(i->second);
}
closeComplete = true;
}
@@ -408,8 +408,10 @@ void SemanticState::disable(ConsumerImpl::shared_ptr c)
session.getConnection().outputTasks.removeOutputTask(c.get());
}
-void SemanticState::unsubscribe(ConsumerImpl::shared_ptr c)
+
+void SemanticState::cancel(ConsumerImpl::shared_ptr c)
{
+ disable(c);
Queue::shared_ptr queue = c->getQueue();
if(queue) {
queue->cancel(c);
@@ -417,12 +419,7 @@ void SemanticState::unsubscribe(ConsumerImpl::shared_ptr c)
Queue::tryAutoDelete(session.getBroker(), queue);
}
}
-}
-
-void SemanticState::cancel(ConsumerImpl::shared_ptr c)
-{
- disable(c);
- unsubscribe(c);
+ c->cancel();
}
void SemanticState::handle(intrusive_ptr<Message> msg) {
diff --git a/cpp/src/qpid/broker/SemanticState.h b/cpp/src/qpid/broker/SemanticState.h
index c08aaba07e..26fd815424 100644
--- a/cpp/src/qpid/broker/SemanticState.h
+++ b/cpp/src/qpid/broker/SemanticState.h
@@ -108,6 +108,7 @@ class SemanticState : private boost::noncopyable {
bool deliver(QueuedMessage& msg);
bool filter(boost::intrusive_ptr<Message> msg);
bool accept(boost::intrusive_ptr<Message> msg);
+ void cancel() {}
void disableNotify();
void enableNotify();
@@ -173,7 +174,6 @@ class SemanticState : private boost::noncopyable {
AckRange findRange(DeliveryId first, DeliveryId last);
void requestDispatch();
void cancel(ConsumerImpl::shared_ptr);
- void unsubscribe(ConsumerImpl::shared_ptr);
void disable(ConsumerImpl::shared_ptr);
public:
diff --git a/cpp/src/tests/QueueTest.cpp b/cpp/src/tests/QueueTest.cpp
index ccdb7810e1..0b1b4cc59e 100644
--- a/cpp/src/tests/QueueTest.cpp
+++ b/cpp/src/tests/QueueTest.cpp
@@ -66,6 +66,7 @@ public:
return true;
};
void notify() {}
+ void cancel() {}
OwnershipToken* getSession() { return 0; }
};