diff options
| author | Ken Giusti <kgiusti@apache.org> | 2012-02-15 14:41:04 +0000 |
|---|---|---|
| committer | Ken Giusti <kgiusti@apache.org> | 2012-02-15 14:41:04 +0000 |
| commit | e9f31d216bd6655fa0fb9728411dbe5e0f0a7778 (patch) | |
| tree | 1bb4dfe26d19b6d191327cafef4d34576fd44a0d /cpp/src | |
| parent | 066f43741d6a2ed4ba0c629cbb8a97cd7344c04a (diff) | |
| download | qpid-python-e9f31d216bd6655fa0fb9728411dbe5e0f0a7778.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
Diffstat (limited to 'cpp/src')
| -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) |
