diff options
| author | Alan Conway <aconway@apache.org> | 2007-08-29 23:27:40 +0000 |
|---|---|---|
| committer | Alan Conway <aconway@apache.org> | 2007-08-29 23:27:40 +0000 |
| commit | e183227707d150b1f42e750df0e90cd7dac8744e (patch) | |
| tree | a9156083c1890852c2d4013d4a856f9f28762946 /cpp/src/qpid/broker/SessionAdapter.h | |
| parent | 7422e57391a89bc2493cba18ca2ef0a84fec7baa (diff) | |
| download | qpid-python-e183227707d150b1f42e750df0e90cd7dac8744e.tar.gz | |
* src/qpid/broker/Session.h, .cpp: Session holds all state of a session including
handlers created for that session. Session is not directly associated with a channel.
* src/qpid/broker/SessionAdapter.h, .cpp: SessionAdapter is bound to a channel
managed by the Connection. It can be attached to and detatched from a Session.
* src/qpid/broker/Connection.cpp, .h: Use SessionAdapter.
* src/qpid/framing/Handler.h: Removed use of shared_ptr. Handlers belong
either to a Session or a Connection and are destroyed with it.
* src/qpid/framing/InputHandler.h, OutputHandler.h: Both now inherit from
FrameHandler and can be used as FrameHandlers. Intermediate step to removing
them entirely.
* src/qpid/broker/ConnectionAdapter.h:
* src/qpid/client/ConnectionHandler.h:
* src/qpid/framing/ChannelAdapter.cpp, .h:
Minor changes required by Handler changes.
git-svn-id: https://svn.apache.org/repos/asf/incubator/qpid/trunk/qpid@570982 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'cpp/src/qpid/broker/SessionAdapter.h')
| -rw-r--r-- | cpp/src/qpid/broker/SessionAdapter.h | 48 |
1 files changed, 25 insertions, 23 deletions
diff --git a/cpp/src/qpid/broker/SessionAdapter.h b/cpp/src/qpid/broker/SessionAdapter.h index a190a7f2b7..237e2c8b64 100644 --- a/cpp/src/qpid/broker/SessionAdapter.h +++ b/cpp/src/qpid/broker/SessionAdapter.h @@ -22,43 +22,45 @@ * */ -#include "qpid/framing/FrameDefaultVisitor.h" #include "qpid/framing/FrameHandler.h" -#include "qpid/broker/SuspendedSessions.h" +#include "qpid/broker/Session.h" +#include "qpid/framing/amqp_types.h" namespace qpid { namespace broker { +class Connection; +class Session; + /** - * Session Handler: Handles frames arriving for a session. - * Implements AMQP session class commands, forwards other traffic - * to the next handler in the chain. + * A SessionAdapter is associated with each active channel. It + * receives incoming frames, handles session commands and manages the + * association between the channel and a session. + * + * SessionAdapters can be stored in a map by value. */ -class SessionAdapter : public framing::FrameVisitorHandler +class SessionAdapter : public framing::FrameHandler { public: - SessionAdapter(); + SessionAdapter(Connection&, framing::ChannelId); ~SessionAdapter(); - protected: - void visit(const framing::SessionAckBody&); - void visit(const framing::SessionAttachedBody&); - void visit(const framing::SessionCloseBody&); - void visit(const framing::SessionClosedBody&); - void visit(const framing::SessionDetachedBody&); - void visit(const framing::SessionFlowBody&); - void visit(const framing::SessionFlowOkBody&); - void visit(const framing::SessionHighWaterMarkBody&); - void visit(const framing::SessionOpenBody&); - void visit(const framing::SessionResumeBody&); - void visit(const framing::SessionSolicitAckBody&); - void visit(const framing::SessionSuspendBody&); + /** Handle AMQP session methods, pass other frames to the session + * if there is one. Frames channel must be == getChannel() + */ + void handle(framing::AMQFrame&); + + /** Returns 0 if not attached to a session */ + Session* getSession() const { return session.get(); } - using FrameDefaultVisitor::visit; + framing::ChannelId getChannel() const { return channel; } + Connection& getConnection() { return connection; } + const Connection& getConnection() const { return connection; } private: - SessionState state; - SuspendedSessions* suspended; + Connection& connection; + const framing::ChannelId channel; + shared_ptr<Session> session; }; }} // namespace qpid::broker |
