From 0a99f79e0d90f0d1c0836fbef124bfe269677840 Mon Sep 17 00:00:00 2001 From: Alan Conway Date: Fri, 13 Jun 2008 17:36:23 +0000 Subject: Fix for broker wraparound problem. git-svn-id: https://svn.apache.org/repos/asf/incubator/qpid/trunk/qpid@667603 13f79535-47bb-0310-9956-ffa450edef68 --- cpp/src/qpid/SessionState.cpp | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) (limited to 'cpp/src/qpid/SessionState.cpp') diff --git a/cpp/src/qpid/SessionState.cpp b/cpp/src/qpid/SessionState.cpp index 9ef2f5f8fb..1be0111489 100644 --- a/cpp/src/qpid/SessionState.cpp +++ b/cpp/src/qpid/SessionState.cpp @@ -124,18 +124,20 @@ void SessionState::senderRecord(const AMQFrame& f) { throw ResourceLimitExceededException("Replay buffer exceeeded hard limit"); } +static const uint32_t SPONTANEOUS_REQUEST_INTERVAL = 65536; + bool SessionState::senderNeedFlush() const { - return config.replayFlushLimit && sender.unflushedSize >= config.replayFlushLimit; + return (sender.sendPoint.command % SPONTANEOUS_REQUEST_INTERVAL == 0) || + (config.replayFlushLimit && sender.unflushedSize >= config.replayFlushLimit); } void SessionState::senderRecordFlush() { - assert(sender.flushPoint <= sender.sendPoint); sender.flushPoint = sender.sendPoint; sender.unflushedSize = 0; } bool SessionState::senderNeedKnownCompleted() const { - return sender.bytesSinceKnownCompleted >= config.replayFlushLimit; + return config.replayFlushLimit && sender.bytesSinceKnownCompleted >= config.replayFlushLimit; } void SessionState::senderRecordKnownCompleted() { @@ -214,7 +216,8 @@ void SessionState::receiverKnownCompleted(const SequenceSet& commands) { } bool SessionState::receiverNeedKnownCompleted() const { - return receiver.bytesSinceKnownCompleted >= config.replayFlushLimit; + return (receiver.expected.command % SPONTANEOUS_REQUEST_INTERVAL == 0) || + (config.replayFlushLimit && receiver.bytesSinceKnownCompleted >= config.replayFlushLimit); } const SessionPoint& SessionState::receiverGetExpected() const { return receiver.expected; } -- cgit v1.2.1