From 0efcf2c5c91f4927ccc00ad1cf391c2f964cc2e1 Mon Sep 17 00:00:00 2001 From: Alan Conway Date: Wed, 27 Jun 2007 21:19:14 +0000 Subject: * src/qpid/framing/ChannelAdapter.cpp: Use handler chains for in and outbound frames. * src/qpid/framing/InputHandler.h, OutputHandler.h, FrameHandler.h: All handlers pass AMQFrame& and have consistent memory management. Terminal OutputHandlers used to take ownership and delete frame, now they make a shallow copy instead. * src/qpid/framing/Handler.h, FrameHandler.h: Simplified. * src/qpid/client/ClientConnection.cpp: * src/qpid/broker/Connection.cpp: * src/qpid/broker/BrokerChannel.cpp: Update for ChannelAdapter changes. git-svn-id: https://svn.apache.org/repos/asf/incubator/qpid/trunk/qpid@551336 13f79535-47bb-0310-9956-ffa450edef68 --- cpp/src/qpid/client/ClientConnection.cpp | 16 +++++++--------- 1 file changed, 7 insertions(+), 9 deletions(-) (limited to 'cpp/src/qpid/client/ClientConnection.cpp') diff --git a/cpp/src/qpid/client/ClientConnection.cpp b/cpp/src/qpid/client/ClientConnection.cpp index d6d03680c1..bddadb0800 100644 --- a/cpp/src/qpid/client/ClientConnection.cpp +++ b/cpp/src/qpid/client/ClientConnection.cpp @@ -133,25 +133,22 @@ void Connection::erase(ChannelId id) { channels.erase(id); } -void Connection::received(AMQFrame* frame){ - // FIXME aconway 2007-01-25: Mutex - ChannelId id = frame->getChannel(); +void Connection::received(AMQFrame& frame){ + ChannelId id = frame.getChannel(); Channel* channel = channels[id]; - // FIXME aconway 2007-01-26: Exception thrown here is hanging the - // client. Need to review use of exceptions. if (channel == 0) THROW_QPID_ERROR( PROTOCOL_ERROR+504, (boost::format("Invalid channel number %g") % id).str()); try{ - channel->handleBody(frame->getBody()); + channel->getHandlers().in->handle(frame); }catch(const qpid::QpidError& e){ channelException( - *channel, dynamic_cast(frame->getBody().get()), e); + *channel, dynamic_cast(frame.getBody().get()), e); } } -void Connection::send(AMQFrame* frame) { +void Connection::send(AMQFrame& frame) { out->send(frame); } @@ -172,7 +169,8 @@ void Connection::idleIn(){ } void Connection::idleOut(){ - out->send(new AMQFrame(version, 0, new AMQHeartbeatBody())); + AMQFrame frame(version, 0, new AMQHeartbeatBody()); + out->send(frame); } }} // namespace qpid::client -- cgit v1.2.1