From ff6f9f47dbbaaf84dde2a86dd8f854fcf3060378 Mon Sep 17 00:00:00 2001 From: Alan Conway Date: Wed, 31 Oct 2007 16:56:57 +0000 Subject: Simplify SessionState, preparing for session thread safety fixes. git-svn-id: https://svn.apache.org/repos/asf/incubator/qpid/trunk/qpid@590751 13f79535-47bb-0310-9956-ffa450edef68 --- cpp/src/qpid/broker/SessionHandler.cpp | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) (limited to 'cpp/src/qpid/broker/SessionHandler.cpp') diff --git a/cpp/src/qpid/broker/SessionHandler.cpp b/cpp/src/qpid/broker/SessionHandler.cpp index 49492ffed1..1d0e67f6ab 100644 --- a/cpp/src/qpid/broker/SessionHandler.cpp +++ b/cpp/src/qpid/broker/SessionHandler.cpp @@ -38,7 +38,8 @@ SessionHandler::SessionHandler(Connection& c, ChannelId ch) connection(c), channel(ch, &c.getOutput()), proxy(out), // Via my own handleOut() for L2 data. peerSession(channel), // Direct to channel for L2 commands. - ignoring(false) {} + ignoring(false), + resuming(false) {} SessionHandler::~SessionHandler() {} @@ -114,7 +115,8 @@ void SessionHandler::resume(const Uuid& id) { assertClosed("resume"); session = connection.broker.getSessionManager().resume(id); session->attach(*this); - SequenceNumber seq = session->resuming(); + resuming=true; + SequenceNumber seq = session->sendingAck(); peerSession.attached(session->getId(), session->getTimeout()); proxy.getSession().ack(seq, SequenceNumberSet()); } @@ -148,7 +150,7 @@ void SessionHandler::closed(uint16_t replyCode, const string& replyText) { } void SessionHandler::localSuspend() { - if (session.get() && session->getState() == SessionState::ATTACHED) { + if (session.get()) { session->detach(); connection.broker.getSessionManager().suspend(session); } @@ -166,7 +168,8 @@ void SessionHandler::ack(uint32_t cumulativeSeenMark, const SequenceNumberSet& /*seenFrameSet*/) { assertAttached("ack"); - if (session->getState() == SessionState::RESUMING) { + if (resuming) { + resuming=false; session->receivedAck(cumulativeSeenMark); framing::SessionState::Replay replay=session->replay(); std::for_each(replay.begin(), replay.end(), -- cgit v1.2.1