summaryrefslogtreecommitdiff
path: root/cpp
diff options
context:
space:
mode:
authorAlan Conway <aconway@apache.org>2008-12-08 12:00:58 +0000
committerAlan Conway <aconway@apache.org>2008-12-08 12:00:58 +0000
commita90b506a12e71b1fa3bbaf0b0a95d62c42d3fd3d (patch)
treecc11944134ff378361c6371aaa3f71c69ac27dc2 /cpp
parentf739d191af76b1b22416f914212153db40abc17d (diff)
downloadqpid-python-a90b506a12e71b1fa3bbaf0b0a95d62c42d3fd3d.tar.gz
Cluster: fixed error in credit allocation.
git-svn-id: https://svn.apache.org/repos/asf/incubator/qpid/trunk/qpid@724326 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'cpp')
-rw-r--r--cpp/src/qpid/cluster/Connection.cpp8
-rw-r--r--cpp/src/qpid/cluster/OutputInterceptor.cpp4
2 files changed, 6 insertions, 6 deletions
diff --git a/cpp/src/qpid/cluster/Connection.cpp b/cpp/src/qpid/cluster/Connection.cpp
index 27b391a1c7..1023e86bae 100644
--- a/cpp/src/qpid/cluster/Connection.cpp
+++ b/cpp/src/qpid/cluster/Connection.cpp
@@ -75,7 +75,7 @@ void Connection::init() {
QPID_LOG(debug, cluster << " new connection: " << *this);
if (isLocal() && !isCatchUp()) {
// FIXME aconway 2008-12-05: configurable credit limit
- output.giveReadCredit(3);
+ output.giveReadCredit(10);
}
}
@@ -91,7 +91,7 @@ bool Connection::doOutput() {
// which stocks up the write buffers with data.
//
void Connection::deliverDoOutput(uint32_t requested) {
- assert(!catchUp);
+
output.deliverDoOutput(requested);
}
@@ -191,7 +191,6 @@ size_t Connection::decode(const char* buffer, size_t size) {
Buffer buf(const_cast<char*>(buffer), size);
while (localDecoder.decode(buf))
received(localDecoder.frame);
- output.giveReadCredit(1);
}
else { // Multicast local connections.
assert(isLocal());
@@ -205,8 +204,7 @@ void Connection::deliverBuffer(Buffer& buf) {
++deliverSeq;
while (mcastDecoder.decode(buf))
delivered(mcastDecoder.frame);
- if (isLocal())
- output.giveReadCredit(1);
+ output.giveReadCredit(1);
}
broker::SessionState& Connection::sessionState() {
diff --git a/cpp/src/qpid/cluster/OutputInterceptor.cpp b/cpp/src/qpid/cluster/OutputInterceptor.cpp
index 77ed154bd0..37b5b1a3e6 100644
--- a/cpp/src/qpid/cluster/OutputInterceptor.cpp
+++ b/cpp/src/qpid/cluster/OutputInterceptor.cpp
@@ -76,10 +76,12 @@ void OutputInterceptor::deliverDoOutput(size_t requested) {
// Run the real doOutput() till we have added the requested data or there's nothing to output.
sent = 0;
+ {
+ sys::Mutex::ScopedUnlock u(lock);
do {
- sys::Mutex::ScopedUnlock u(lock);
moreOutput = parent.getBrokerConnection().doOutput();
} while (sent < requested && moreOutput);
+ }
sent += buf; // Include buffered data in the sent total.
QPID_LOG(trace, "Delivered doOutput: requested=" << requested << " output=" << sent << " more=" << moreOutput);