From f78e70d928e27eeaa40ed6064fd3d236d014b1da Mon Sep 17 00:00:00 2001 From: Kenneth Anthony Giusti Date: Wed, 15 Feb 2012 14:41:04 +0000 Subject: 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 --- cpp/src/qpid/amqp_0_10/Connection.cpp | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) (limited to 'cpp/src') 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) -- cgit v1.2.1