summaryrefslogtreecommitdiff
path: root/qpid/cpp/src
diff options
context:
space:
mode:
authorKenneth Anthony Giusti <kgiusti@apache.org>2012-02-15 14:41:04 +0000
committerKenneth Anthony Giusti <kgiusti@apache.org>2012-02-15 14:41:04 +0000
commit07d52e55da5a28788c7604d0b445549a92cda238 (patch)
tree15160aafe666840908b201021d979df9832d3604 /qpid/cpp/src
parent7be5af63ce577a5e791da305e2c8d518afc6a730 (diff)
downloadqpid-python-07d52e55da5a28788c7604d0b445549a92cda238.tar.gz
QPID-3841: improve batching of outbound messages
git-svn-id: https://svn.apache.org/repos/asf/qpid/trunk@1244504 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'qpid/cpp/src')
-rw-r--r--qpid/cpp/src/qpid/amqp_0_10/Connection.cpp7
1 files changed, 6 insertions, 1 deletions
diff --git a/qpid/cpp/src/qpid/amqp_0_10/Connection.cpp b/qpid/cpp/src/qpid/amqp_0_10/Connection.cpp
index 22a37b7115..ceeaadf70c 100644
--- a/qpid/cpp/src/qpid/amqp_0_10/Connection.cpp
+++ b/qpid/cpp/src/qpid/amqp_0_10/Connection.cpp
@@ -95,7 +95,12 @@ size_t Connection::encode(const char* buffer, size_t size) {
QPID_LOG(trace, "SENT [" << identifier << "]: " << workQueue.front());
workQueue.pop_front();
encoded += frameSize;
- if (workQueue.empty() && out.available() > 0) connection->doOutput();
+ if (workQueue.empty() && out.available() > 0) {
+ // try to get more output
+ connection->doOutput();
+ Mutex::ScopedLock l(frameQueueLock);
+ workQueue.swap(frameQueue); // Need to get any new frames into the work queue
+ }
}
assert(workQueue.empty() || workQueue.front().encodedSize() <= size);
if (!workQueue.empty() && workQueue.front().encodedSize() > size)