From 761e10501fe5ea51f9d8c40d9a200ae27193ab23 Mon Sep 17 00:00:00 2001 From: Alan Conway Date: Fri, 31 Aug 2007 20:51:22 +0000 Subject: * Summary: - Moved BrokerChannel functionality into Session. - Moved ChannelHandler methods handling into SessionAdapter. - Updated all handlers to use session. (We're still using AMQP channel methods in SessionAdapter) Roles & responsibilities: Session: - represents an _open_ session, may be active or suspended. - ows all session state including handler chains. - attahced to SessionAdapter when active, not when suspended. SessionAdapter: - reprents the association of a channel with a session. - owned by Connection, kept in the session map. - channel open == SessionAdapter.getSessio() != 0 Anything that depends on attachment to a channel, connection or protocol should be in SessionAdpater. Anything that suvives a session suspend belongs in Session. git-svn-id: https://svn.apache.org/repos/asf/incubator/qpid/trunk/qpid@571575 13f79535-47bb-0310-9956-ffa450edef68 --- cpp/src/qpid/broker/Connection.cpp | 22 ++++++---------------- 1 file changed, 6 insertions(+), 16 deletions(-) (limited to 'cpp/src/qpid/broker/Connection.cpp') diff --git a/cpp/src/qpid/broker/Connection.cpp b/cpp/src/qpid/broker/Connection.cpp index 08d5ba0ab3..825ce4978c 100644 --- a/cpp/src/qpid/broker/Connection.cpp +++ b/cpp/src/qpid/broker/Connection.cpp @@ -23,7 +23,7 @@ #include #include "Connection.h" -#include "BrokerChannel.h" +#include "Session.h" #include "qpid/framing/AMQP_ClientProxy.h" #include "BrokerAdapter.h" #include "SemanticHandler.h" @@ -52,12 +52,8 @@ void Connection::received(framing::AMQFrame& frame){ if (frame.getChannel() == 0) { adapter.handle(frame); } else { - // FIXME aconway 2007-08-29: review shutdown, not more shared_ptr. - // OLD COMMENT: - // Assign handler to new shared_ptr, as it may be erased - // from the map by handle() if frame is a ChannelClose. - // - getChannel((frame.getChannel())).in(frame); + SessionAdapter sa = getChannel(frame.getChannel()); + sa.in(frame); } } @@ -98,18 +94,12 @@ void Connection::closeChannel(uint16_t id) { if (i != channels.end()) channels.erase(i); } - -FrameHandler::Chains& Connection::getChannel(ChannelId id) { - // FIXME aconway 2007-08-29: Assuming session on construction, - // move this to SessionAdapter::open. +SessionAdapter Connection::getChannel(ChannelId id) { boost::optional& ch = channels[id]; if (!ch) { - ch = boost::in_place(boost::ref(*this), id); // FIXME aconway 2007-08-29: - assert(ch->getSession()); - broker.update(id, *ch->getSession()); + ch = boost::in_place(boost::ref(*this), id); } - assert(ch->getSession()); - return *ch->getSession(); + return *ch; } -- cgit v1.2.1