diff options
| author | Alan Conway <aconway@apache.org> | 2007-06-27 21:19:14 +0000 |
|---|---|---|
| committer | Alan Conway <aconway@apache.org> | 2007-06-27 21:19:14 +0000 |
| commit | 0efcf2c5c91f4927ccc00ad1cf391c2f964cc2e1 (patch) | |
| tree | a9318ac4787cf588dd1329c2e557d8f870be20cc /cpp/src/qpid/sys/apr/LFSessionContext.cpp | |
| parent | 548abd065f91bc1f238ac98c24edf410edf10356 (diff) | |
| download | qpid-python-0efcf2c5c91f4927ccc00ad1cf391c2f964cc2e1.tar.gz | |
* src/qpid/framing/ChannelAdapter.cpp: Use handler chains
for in and outbound frames.
* src/qpid/framing/InputHandler.h, OutputHandler.h, FrameHandler.h:
All handlers pass AMQFrame& and have consistent memory management.
Terminal OutputHandlers used to take ownership and delete frame, now
they make a shallow copy instead.
* src/qpid/framing/Handler.h, FrameHandler.h: Simplified.
* src/qpid/client/ClientConnection.cpp:
* src/qpid/broker/Connection.cpp:
* src/qpid/broker/BrokerChannel.cpp:
Update for ChannelAdapter changes.
git-svn-id: https://svn.apache.org/repos/asf/incubator/qpid/trunk/qpid@551336 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'cpp/src/qpid/sys/apr/LFSessionContext.cpp')
| -rw-r--r-- | cpp/src/qpid/sys/apr/LFSessionContext.cpp | 14 |
1 files changed, 6 insertions, 8 deletions
diff --git a/cpp/src/qpid/sys/apr/LFSessionContext.cpp b/cpp/src/qpid/sys/apr/LFSessionContext.cpp index 0717dcc9ae..4e708fd747 100644 --- a/cpp/src/qpid/sys/apr/LFSessionContext.cpp +++ b/cpp/src/qpid/sys/apr/LFSessionContext.cpp @@ -62,7 +62,7 @@ void LFSessionContext::read(){ try{ while(frame.decode(in)){ QPID_LOG(debug, "RECV: " << frame); - handler->received(&frame); + handler->received(frame); } }catch(const std::exception& e){ QPID_LOG(error, e.what()); @@ -94,14 +94,12 @@ void LFSessionContext::write(){ if(!framesToWrite.empty()){ out.clear(); bool encoded(false); - AMQFrame* frame = framesToWrite.front(); - while(frame && out.available() >= frame->size()){ + while(!framesToWrite.empty() && out.available() >= framesToWrite.front().size()){ + AMQFrame& frame = framesToWrite.front(); encoded = true; - frame->encode(out); - QPID_LOG(debug, "SENT: " << *frame); - delete frame; + frame.encode(out); + QPID_LOG(debug, "SENT: " << frame); framesToWrite.pop(); - frame = framesToWrite.empty() ? 0 : framesToWrite.front(); } if(!encoded) THROW_QPID_ERROR(FRAMING_ERROR, "Could not write frame, too large for buffer."); out.flip(); @@ -118,7 +116,7 @@ void LFSessionContext::write(){ } } -void LFSessionContext::send(AMQFrame* frame){ +void LFSessionContext::send(AMQFrame& frame){ Mutex::ScopedLock l(writeLock); if(!closing){ framesToWrite.push(frame); |
