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

Re: [Libevent-users] Creating a repeater/forwarder



On Sat, Mar 9, 2013 at 5:20 PM, Oliver Smith <oliver@xxxxxxx> wrote:
> I'm trying to create a fairly low overhead repeater process which will
> accept N connections (where N is going to be relatively small, in the area
> of 5-12) connections from other processes and which will forward incoming
> packets from one connection to all of the others.
>
>  conn1 --'hello'--> repeater --'hello'--> conn{2,3,..N}
>
> Copy elimination FTW, but presumably there will be at least one copy from
> the source buffers to the output buffers for each subsequent connection.
>
> Right now, I have the following, but I'm wondering if there's any huge
> "d'oh" in it that I could reduce the amount of copying; not sure if there's
> some way to point multiple out buffers at a single in buffer (well, without
> chaos as they all randomly drain it).
>

What you want sounds kind of like something you could do with
evbuffer_add_reference.  Or possibly you want the new function in
libevent 2.1-alpha, evbuffer_add_buffer_reference.

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