qpid-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Alan Conway <acon...@redhat.com>
Subject C++ client/broker: avoiding unread
Date Wed, 24 Sep 2008 20:07:07 GMT
Just FYI: In the cluster code I needed to decode from data buffers that
might not coincide with frame boundaries, but without having anything
like the AsyncIOs "unread" feature.

qpid/framing/FrameDecoder.h is a simple and I believe efficient solution
to this problem. It provides a buffer (growable but never larger than
the largest frame decoded) to save a frame fragment found at the end of
a read buffer. The rest of the frame is copied from the front of the
next read buffer when it arrives. Only fragmented frames are ever
copied, at most one per read buffer.

The buffer does get reallocated but the number of allocations will be
small.

Cheers,
Alan.


Mime
View raw message