Return-Path: Delivered-To: apmail-incubator-qpid-commits-archive@locus.apache.org Received: (qmail 56377 invoked from network); 13 Jun 2008 12:30:24 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.2) by minotaur.apache.org with SMTP; 13 Jun 2008 12:30:24 -0000 Received: (qmail 54559 invoked by uid 500); 13 Jun 2008 12:30:26 -0000 Delivered-To: apmail-incubator-qpid-commits-archive@incubator.apache.org Received: (qmail 54543 invoked by uid 500); 13 Jun 2008 12:30:26 -0000 Mailing-List: contact qpid-commits-help@incubator.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: qpid-dev@incubator.apache.org Delivered-To: mailing list qpid-commits@incubator.apache.org Received: (qmail 54529 invoked by uid 99); 13 Jun 2008 12:30:26 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Fri, 13 Jun 2008 05:30:26 -0700 X-ASF-Spam-Status: No, hits=-2000.0 required=10.0 tests=ALL_TRUSTED X-Spam-Check-By: apache.org Received: from [140.211.11.4] (HELO eris.apache.org) (140.211.11.4) by apache.org (qpsmtpd/0.29) with ESMTP; Fri, 13 Jun 2008 12:29:45 +0000 Received: by eris.apache.org (Postfix, from userid 65534) id 2E1202388A0A; Fri, 13 Jun 2008 05:30:03 -0700 (PDT) Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: svn commit: r667503 - /incubator/qpid/trunk/qpid/cpp/src/qpid/SessionState.cpp Date: Fri, 13 Jun 2008 12:30:02 -0000 To: qpid-commits@incubator.apache.org From: aconway@apache.org X-Mailer: svnmailer-1.0.8 Message-Id: <20080613123003.2E1202388A0A@eris.apache.org> X-Virus-Checked: Checked by ClamAV on apache.org Author: aconway Date: Fri Jun 13 05:30:02 2008 New Revision: 667503 URL: http://svn.apache.org/viewvc?rev=667503&view=rev Log: Fix bug in SessionState - avoid all replay calculations for timeout==0. Modified: incubator/qpid/trunk/qpid/cpp/src/qpid/SessionState.cpp Modified: incubator/qpid/trunk/qpid/cpp/src/qpid/SessionState.cpp URL: http://svn.apache.org/viewvc/incubator/qpid/trunk/qpid/cpp/src/qpid/SessionState.cpp?rev=667503&r1=667502&r2=667503&view=diff ============================================================================== --- incubator/qpid/trunk/qpid/cpp/src/qpid/SessionState.cpp (original) +++ incubator/qpid/trunk/qpid/cpp/src/qpid/SessionState.cpp Fri Jun 13 05:30:02 2008 @@ -99,6 +99,8 @@ SessionPoint SessionState::senderGetReplayPoint() const { return sender.replayPoint; } SessionState::ReplayRange SessionState::senderExpected(const SessionPoint& expect) { + if (timeout == 0) + return SessionState::ReplayRange(); if (expect < sender.replayPoint || sender.sendPoint < expect) throw InvalidArgumentException(QPID_MSG(getId() << ": expected command-point out of range.")); QPID_LOG(debug, getId() << ": sender expected point moved to " << expect); @@ -114,22 +116,24 @@ if (isControl(f)) return; // Ignore control frames. QPID_LOG_IF(debug, f.getMethod(), getId() << ": sent cmd " << sender.sendPoint.command << ": " << *f.getMethod()); stateful = true; - if (timeout) sender.replayList.push_back(f); - sender.unflushedSize += f.size(); + if (timeout) { + sender.replayList.push_back(f); + sender.replaySize += f.size(); + sender.unflushedSize += f.size(); + if (config.replayHardLimit && config.replayHardLimit < sender.replaySize) + throw ResourceLimitExceededException("Replay buffer exceeeded hard limit"); + } sender.bytesSinceKnownCompleted += f.size(); - sender.replaySize += f.size(); sender.incomplete += sender.sendPoint.command; sender.sendPoint.advance(f); - if (config.replayHardLimit && config.replayHardLimit < sender.replaySize) - throw ResourceLimitExceededException("Replay buffer exceeeded hard limit"); } bool SessionState::senderNeedFlush() const { - return config.replayFlushLimit && sender.unflushedSize >= config.replayFlushLimit; + return timeout != 0 && config.replayFlushLimit && sender.unflushedSize >= config.replayFlushLimit; } void SessionState::senderRecordFlush() { - assert(sender.flushPoint <= sender.sendPoint); + if (timeout == 0) return; sender.flushPoint = sender.sendPoint; sender.unflushedSize = 0; } @@ -143,6 +147,7 @@ } void SessionState::senderConfirmed(const SessionPoint& confirmed) { + if (timeout == 0) return; if (confirmed > sender.sendPoint) throw InvalidArgumentException(QPID_MSG(getId() << "Confirmed commands not yet sent.")); QPID_LOG(debug, getId() << ": sender confirmed point moved to " << confirmed); @@ -158,7 +163,6 @@ if (sender.replayPoint > sender.flushPoint) sender.flushPoint = sender.replayPoint; sender.replayList.erase(sender.replayList.begin(), i); - assert(sender.replayPoint.offset == 0); } void SessionState::senderCompleted(const SequenceSet& commands) {