diff options
| author | Alan Conway <aconway@apache.org> | 2007-09-28 16:21:34 +0000 |
|---|---|---|
| committer | Alan Conway <aconway@apache.org> | 2007-09-28 16:21:34 +0000 |
| commit | 8b82aef0397d65de0c7278476e4f409fcc636306 (patch) | |
| tree | a25d9bbb01203335bc1450a5e5ed0c29074913ae /cpp/src/qpid/broker/SessionHandler.cpp | |
| parent | f689c47486b4cfc7655e37da2b232fe27be1cc42 (diff) | |
| download | qpid-python-8b82aef0397d65de0c7278476e4f409fcc636306.tar.gz | |
* src/tests/ClientSessionTest.cpp: Suspend/resume tests.
* broker/SessionManager.cpp, broker/SessionHandler.cpp:
Implement suspend/resume
* client/ScopedAssociation.h, SessionCore.h, SessionHandler.h:
Simplified relationships.
- Removed ScopedAssociation.
- SessionHandler: is now a member of SessionCore.
- SessionCore: shared_ptr ownership by Session(s) and ConnectionImpl.
- Using framing::FrameHandler interfaces.
git-svn-id: https://svn.apache.org/repos/asf/incubator/qpid/trunk/qpid@580403 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'cpp/src/qpid/broker/SessionHandler.cpp')
| -rw-r--r-- | cpp/src/qpid/broker/SessionHandler.cpp | 38 |
1 files changed, 19 insertions, 19 deletions
diff --git a/cpp/src/qpid/broker/SessionHandler.cpp b/cpp/src/qpid/broker/SessionHandler.cpp index ecbffed465..d7308572f9 100644 --- a/cpp/src/qpid/broker/SessionHandler.cpp +++ b/cpp/src/qpid/broker/SessionHandler.cpp @@ -35,7 +35,7 @@ SessionHandler::SessionHandler(Connection& c, ChannelId ch) connection(c), channel(ch), proxy(out), ignoring(false) {} -SessionHandler::~SessionHandler() { } +SessionHandler::~SessionHandler() {} namespace { ClassId classId(AMQMethodBody* m) { return m ? m->amqpMethodId() : 0; } @@ -78,18 +78,15 @@ void SessionHandler::handleOut(AMQFrame& f) { void SessionHandler::assertOpen(const char* method) { if (!session.get()) throw ChannelErrorException( - QPID_MSG(""<<method<<" failed: No session for channel " + QPID_MSG(method << " failed: No session for channel " << getChannel())); } void SessionHandler::assertClosed(const char* method) { - // FIXME aconway 2007-08-31: Should raise channel-busy, need - // to update spec. if (session.get()) - throw PreconditionFailedException( - QPID_MSG(""<<method<<" failed: " - << channel << " already open on channel " - << getChannel())); + throw ChannelBusyException( + QPID_MSG(method << " failed: channel " << channel + << " is already open.")); } void SessionHandler::open(uint32_t detachedLifetime) { @@ -100,6 +97,12 @@ void SessionHandler::open(uint32_t detachedLifetime) { getProxy().getSession().attached(session->getId(), session->getTimeout()); } +void SessionHandler::resume(const Uuid& id) { + assertClosed("resume"); + session = connection.broker.getSessionManager().resume(*this, id); + getProxy().getSession().attached(session->getId(), session->getTimeout()); +} + void SessionHandler::flow(bool /*active*/) { // FIXME aconway 2007-09-19: Removed in 0-10, remove assert(0); throw NotImplementedException(); @@ -115,26 +118,23 @@ void SessionHandler::close() { ignoring=false; session.reset(); getProxy().getSession().closed(REPLY_SUCCESS, "ok"); - // No need to remove from connection map, will be re-used - // if channel is re-opened. + assert(&connection.getChannel(channel) == this); + connection.closeChannel(channel); } void SessionHandler::closed(uint16_t replyCode, const string& replyText) { - // FIXME aconway 2007-08-31: Extend constants.h to map codes & ids - // to text names. QPID_LOG(warning, "Received session.closed: "<<replyCode<<" "<<replyText); ignoring=false; session.reset(); - // No need to remove from connection map, will be re-used - // if channel is re-opened. -} - -void SessionHandler::resume(const Uuid& /*sessionId*/) { - assert(0); throw NotImplementedException(); } void SessionHandler::suspend() { - assert(0); throw NotImplementedException(); + assertOpen("suspend"); + connection.broker.getSessionManager().suspend(session); + assert(!session.get()); + getProxy().getSession().detached(); + assert(&connection.getChannel(channel) == this); + connection.closeChannel(channel); } void SessionHandler::ack(uint32_t /*cumulativeSeenMark*/, |
