summaryrefslogtreecommitdiff
path: root/qpid/cpp/src/qpid/SessionState.cpp
diff options
context:
space:
mode:
authorAlan Conway <aconway@apache.org>2008-06-04 16:00:17 +0000
committerAlan Conway <aconway@apache.org>2008-06-04 16:00:17 +0000
commit563e02f00fd35634cde9db8eaa6c9f29c1456afb (patch)
treeb46ff4a005e73509aebc2f66ba21f99df8b4b490 /qpid/cpp/src/qpid/SessionState.cpp
parent41a04a45030b3d3663d3dea918b94106c4d83db3 (diff)
downloadqpid-python-563e02f00fd35634cde9db8eaa6c9f29c1456afb.tar.gz
Increased default flush interval to 1MB, send spontaneous known-completed at the flush interval.
git-svn-id: https://svn.apache.org/repos/asf/incubator/qpid/trunk@663271 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'qpid/cpp/src/qpid/SessionState.cpp')
-rw-r--r--qpid/cpp/src/qpid/SessionState.cpp20
1 files changed, 19 insertions, 1 deletions
diff --git a/qpid/cpp/src/qpid/SessionState.cpp b/qpid/cpp/src/qpid/SessionState.cpp
index 4b4e79801f..ce8f45d085 100644
--- a/qpid/cpp/src/qpid/SessionState.cpp
+++ b/qpid/cpp/src/qpid/SessionState.cpp
@@ -90,6 +90,10 @@ bool SessionPoint::operator==(const SessionPoint& x) const {
}
+SessionState::SendState::SendState() : unflushedSize(), replaySize(), bytesSinceKnownCompleted() {}
+
+SessionState::ReceiveState::ReceiveState() {}
+
SessionPoint SessionState::senderGetCommandPoint() { return sender.sendPoint; }
SequenceSet SessionState::senderGetIncomplete() const { return sender.incomplete; }
SessionPoint SessionState::senderGetReplayPoint() const { return sender.replayPoint; }
@@ -112,6 +116,7 @@ void SessionState::senderRecord(const AMQFrame& f) {
stateful = true;
if (timeout) sender.replayList.push_back(f);
sender.unflushedSize += f.size();
+ sender.bytesSinceKnownCompleted += f.size();
sender.replaySize += f.size();
sender.incomplete += sender.sendPoint.command;
sender.sendPoint.advance(f);
@@ -129,6 +134,18 @@ void SessionState::senderRecordFlush() {
sender.unflushedSize = 0;
}
+bool SessionState::senderNeedKnownCompleted() const {
+ // FIXME aconway 2008-06-04: this is unpleasant - replayFlushLimit == 0
+ // means never send spontaneous flush, but sends a knownCompleted for
+ // every completed. Need separate configuration?
+ //
+ return sender.bytesSinceKnownCompleted >= config.replayFlushLimit;
+}
+
+void SessionState::senderRecordKnownCompleted() {
+ sender.bytesSinceKnownCompleted = 0;
+}
+
void SessionState::senderConfirmed(const SessionPoint& confirmed) {
if (confirmed > sender.sendPoint)
throw InvalidArgumentException(QPID_MSG(getId() << "Confirmed commands not yet sent."));
@@ -213,7 +230,8 @@ SequenceNumber SessionState::receiverGetCurrent() const {
SessionState::Configuration::Configuration(size_t flush, size_t hard) :
replayFlushLimit(flush), replayHardLimit(hard) {}
-SessionState::SessionState(const SessionId& i, const Configuration& c) : id(i), timeout(), config(c), stateful()
+SessionState::SessionState(const SessionId& i, const Configuration& c)
+ : id(i), timeout(), config(c), stateful()
{
QPID_LOG(debug, "SessionState::SessionState " << id << ": " << this);
}