From bf74286e6a5eba055fd8bf9410c325205b8595d5 Mon Sep 17 00:00:00 2001 From: Gordon Sim Date: Fri, 17 Nov 2006 11:03:22 +0000 Subject: Some fixes and tests for bugs uncovered during testing of persistence. git-svn-id: https://svn.apache.org/repos/asf/incubator/qpid/trunk/qpid@476108 13f79535-47bb-0310-9956-ffa450edef68 --- cpp/src/qpid/broker/SessionHandlerImpl.cpp | 27 +++++++++++++++++---------- 1 file changed, 17 insertions(+), 10 deletions(-) (limited to 'cpp/src/qpid/broker/SessionHandlerImpl.cpp') diff --git a/cpp/src/qpid/broker/SessionHandlerImpl.cpp b/cpp/src/qpid/broker/SessionHandlerImpl.cpp index b1ac30d493..bbb5d22c8d 100644 --- a/cpp/src/qpid/broker/SessionHandlerImpl.cpp +++ b/cpp/src/qpid/broker/SessionHandlerImpl.cpp @@ -97,6 +97,9 @@ void SessionHandlerImpl::received(qpid::framing::AMQFrame* frame){ client.getChannel().close(channel, e.code, e.text, method->amqpClassId(), method->amqpMethodId()); }catch(ConnectionException& e){ client.getConnection().close(0, e.code, e.text, method->amqpClassId(), method->amqpMethodId()); + }catch(std::exception& e){ + string error(e.what()); + client.getConnection().close(0, 541/*internal error*/, error, method->amqpClassId(), method->amqpMethodId()); } break; @@ -132,16 +135,20 @@ void SessionHandlerImpl::idleIn(){ } void SessionHandlerImpl::closed(){ - for(channel_iterator i = channels.begin(); i != channels.end(); i = channels.begin()){ - Channel* c = i->second; - channels.erase(i); - c->close(); - delete c; - } - for(queue_iterator i = exclusiveQueues.begin(); i < exclusiveQueues.end(); i = exclusiveQueues.begin()){ - string name = (*i)->getName(); - queues->destroy(name); - exclusiveQueues.erase(i); + try { + for(channel_iterator i = channels.begin(); i != channels.end(); i = channels.begin()){ + Channel* c = i->second; + channels.erase(i); + c->close(); + delete c; + } + for(queue_iterator i = exclusiveQueues.begin(); i < exclusiveQueues.end(); i = exclusiveQueues.begin()){ + string name = (*i)->getName(); + queues->destroy(name); + exclusiveQueues.erase(i); + } + } catch(std::exception& e) { + std::cout << "Caught unhandled exception while closing session: " << e.what() << std::endl; } } -- cgit v1.2.1