diff options
| author | Alan Conway <aconway@apache.org> | 2008-06-13 17:36:23 +0000 |
|---|---|---|
| committer | Alan Conway <aconway@apache.org> | 2008-06-13 17:36:23 +0000 |
| commit | 0a99f79e0d90f0d1c0836fbef124bfe269677840 (patch) | |
| tree | 1a6ee2ce409947d5a6956411483e9182e0f76a0c /cpp/src/qpid/SessionState.cpp | |
| parent | 34cdb55ef0a755be5f0bbd965418b11e08e86031 (diff) | |
| download | qpid-python-0a99f79e0d90f0d1c0836fbef124bfe269677840.tar.gz | |
Fix for broker wraparound problem.
git-svn-id: https://svn.apache.org/repos/asf/incubator/qpid/trunk/qpid@667603 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'cpp/src/qpid/SessionState.cpp')
| -rw-r--r-- | cpp/src/qpid/SessionState.cpp | 11 |
1 files changed, 7 insertions, 4 deletions
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; } |
