[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]

Re: [Libevent-users] Send evbuffer to multiple clients



On Wed, Jun 1, 2011 at 11:28 AM, Joachim Bauch <jojo@xxxxxxxxxxx> wrote:
> Hi,
>
> what is the best way to pass data from one evbuffer to multiple
> clients (i.e. other evbuffers)? There seems to be no direct way as
> the obvious "evbuffer_add_buffer" removes data from the source buffer.
>
> For now I use a combination of "evbuffer_pullup" and
> "evbuffer_add_reference" with my own reference counting of the
> source buffer, but probably there is a better way I'm not seeing
> right now.

Hm.  If there's nothing hideously complex in the source buffer (that
is, nothing added with evbuffer_add_file), you could try an
appropriate combination of evbuffer_peek and evbuffer_add_reference.
Other than that, I'm not thinking of much.

I'd love to get a better API for this in 2.1, if anybody wants to write one.

-- 
Nick
***********************************************************************
To unsubscribe, send an e-mail to majordomo@xxxxxxxxxxxxx with
unsubscribe libevent-users    in the body.