diff options
author | Kenneth Anthony Giusti <kgiusti@apache.org> | 2012-02-15 14:41:04 +0000 |
---|---|---|
committer | Kenneth Anthony Giusti <kgiusti@apache.org> | 2012-02-15 14:41:04 +0000 |
commit | f78e70d928e27eeaa40ed6064fd3d236d014b1da (patch) | |
tree | 1bb4dfe26d19b6d191327cafef4d34576fd44a0d | |
parent | 055864d41ad23deb3f0b63fa65adb5bc2cd0871b (diff) | |
download | qpid-python-f78e70d928e27eeaa40ed6064fd3d236d014b1da.tar.gz |
QPID-3841: improve batching of outbound messages
git-svn-id: https://svn.apache.org/repos/asf/qpid/trunk/qpid@1244504 13f79535-47bb-0310-9956-ffa450edef68
-rw-r--r-- | cpp/src/qpid/amqp_0_10/Connection.cpp | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/cpp/src/qpid/amqp_0_10/Connection.cpp b/cpp/src/qpid/amqp_0_10/Connection.cpp index 22a37b7115..ceeaadf70c 100644 --- a/cpp/src/qpid/amqp_0_10/Connection.cpp +++ b/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) |