diff options
author | Gordon Sim <gsim@apache.org> | 2006-09-22 09:53:47 +0000 |
---|---|---|
committer | Gordon Sim <gsim@apache.org> | 2006-09-22 09:53:47 +0000 |
commit | 488beb5a2a072afe2be0c7a1f679a5049f3b2e19 (patch) | |
tree | ec5d2f70029800a12d3fdd6a91cc0169010a85ac /cpp/broker/src/Channel.cpp | |
parent | 6225325010374b21f589e4daba8ddd48564786fa (diff) | |
download | qpid-python-488beb5a2a072afe2be0c7a1f679a5049f3b2e19.tar.gz |
Added tests for basic_cancel and for handling of invalid channel ids.
git-svn-id: https://svn.apache.org/repos/asf/incubator/qpid/trunk/qpid@448881 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'cpp/broker/src/Channel.cpp')
-rw-r--r-- | cpp/broker/src/Channel.cpp | 19 |
1 files changed, 12 insertions, 7 deletions
diff --git a/cpp/broker/src/Channel.cpp b/cpp/broker/src/Channel.cpp index 6980fe5a1b..f1f7d63a39 100644 --- a/cpp/broker/src/Channel.cpp +++ b/cpp/broker/src/Channel.cpp @@ -57,11 +57,14 @@ void Channel::consume(string& tag, Queue::shared_ptr queue, bool acks, bool excl } void Channel::cancel(string& tag){ - ConsumerImpl* c = consumers[tag]; - if(c){ - c->cancel(); - consumers.erase(tag); - delete c; + consumer_iterator i = consumers.find(tag); + if(i != consumers.end()){ + ConsumerImpl* c = i->second; + consumers.erase(i); + if(c){ + c->cancel(); + delete c; + } } } @@ -69,9 +72,11 @@ void Channel::close(){ //cancel all consumers for(consumer_iterator i = consumers.begin(); i != consumers.end(); i = consumers.begin() ){ ConsumerImpl* c = i->second; - c->cancel(); consumers.erase(i); - delete c; + if(c){ + c->cancel(); + delete c; + } } } |