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 | 924764a6a8dbcb0a2dd7a432221987302b389af8 (patch) | |
| tree | 06f5fdf4845fd07fbbbbec24f8de324b37666bef /qpid/cpp/broker/src/Channel.cpp | |
| parent | 69717c3785632ae8c1f85a5e8ee07def87be2ef6 (diff) | |
| download | qpid-python-924764a6a8dbcb0a2dd7a432221987302b389af8.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@448881 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'qpid/cpp/broker/src/Channel.cpp')
| -rw-r--r-- | qpid/cpp/broker/src/Channel.cpp | 19 |
1 files changed, 12 insertions, 7 deletions
diff --git a/qpid/cpp/broker/src/Channel.cpp b/qpid/cpp/broker/src/Channel.cpp index 6980fe5a1b..f1f7d63a39 100644 --- a/qpid/cpp/broker/src/Channel.cpp +++ b/qpid/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; + } } } |
