From b1200b51f070c5b1c0f8d2683af815fe80df9d1c Mon Sep 17 00:00:00 2001 From: Gordon Sim Date: Mon, 7 Apr 2008 11:51:07 +0000 Subject: 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 --- cpp/src/qpid/broker/PreviewConnectionCodec.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'cpp/src/qpid/broker/PreviewConnectionCodec.cpp') 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.")); -- cgit v1.2.1