summaryrefslogtreecommitdiff
path: root/cpp/src
diff options
context:
space:
mode:
authorGordon Sim <gsim@apache.org>2008-04-07 11:51:07 +0000
committerGordon Sim <gsim@apache.org>2008-04-07 11:51:07 +0000
commitb1200b51f070c5b1c0f8d2683af815fe80df9d1c (patch)
tree2f10f9b4d90bcfc398bb0d48a738b23572df7f25 /cpp/src
parent4734b4f16482e331f3c5008f66ffd87fa7a79bea (diff)
downloadqpid-python-b1200b51f070c5b1c0f8d2683af815fe80df9d1c.tar.gz
AsynchIoAcceptor.cpp: Limit output from codec to one buffer per 'idle' call.
PreviewConnectionCodec: Generate output frames for encoding while available and while they can fit in the buffer given git-svn-id: https://svn.apache.org/repos/asf/incubator/qpid/trunk/qpid@645470 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'cpp/src')
-rw-r--r--cpp/src/qpid/broker/PreviewConnectionCodec.cpp3
-rw-r--r--cpp/src/qpid/sys/AsynchIOAcceptor.cpp2
2 files changed, 3 insertions, 2 deletions
diff --git a/cpp/src/qpid/broker/PreviewConnectionCodec.cpp b/cpp/src/qpid/broker/PreviewConnectionCodec.cpp
index d3a5281109..b6c9b03776 100644
--- a/cpp/src/qpid/broker/PreviewConnectionCodec.cpp
+++ b/cpp/src/qpid/broker/PreviewConnectionCodec.cpp
@@ -40,7 +40,7 @@ size_t PreviewConnectionCodec::decode(const char* buffer, size_t size) {
}
bool PreviewConnectionCodec::canEncode() {
- if (!frameQueueClosed) connection.doOutput();
+ if (!frameQueueClosed && frameQueue.empty()) connection.doOutput();
return !frameQueue.empty();
}
@@ -56,6 +56,7 @@ size_t PreviewConnectionCodec::encode(const char* buffer, size_t size) {
frameQueue.front().encode(out);
QPID_LOG(trace, "SENT [" << identifier << "]: " << frameQueue.front());
frameQueue.pop();
+ if (!frameQueueClosed && frameQueue.empty()) connection.doOutput();
}
if (!frameQueue.empty() && frameQueue.front().size() > size)
throw framing::ContentTooLargeException(QPID_MSG("Could not write frame, too large for buffer."));
diff --git a/cpp/src/qpid/sys/AsynchIOAcceptor.cpp b/cpp/src/qpid/sys/AsynchIOAcceptor.cpp
index 6502885ed0..153557c5e5 100644
--- a/cpp/src/qpid/sys/AsynchIOAcceptor.cpp
+++ b/cpp/src/qpid/sys/AsynchIOAcceptor.cpp
@@ -301,7 +301,7 @@ void AsynchIOHandler::idle(AsynchIO&){
return;
}
if (codec == 0) return;
- while (codec->canEncode()) {
+ if (codec->canEncode()) {
// Try and get a queued buffer if not then construct new one
AsynchIO::BufferBase* buff = aio->getQueuedBuffer();
if (!buff) buff = new Buff;