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

Re: [Libevent-users] filter bufferevents and timeout



Thanks, maybe i will handle the filtering in the read callback of the receiving socket bufferevent, it's quite light ...

----- Mail original -----
De: "Azat Khuzhin" <a3at.mail@xxxxxxxxx>
À: libevent-users@xxxxxxxxxxxxx
Envoyé: Jeudi 16 Novembre 2017 11:25:18
Objet: Re: [Libevent-users] filter bufferevents and timeout

On Wed, Nov 15, 2017 at 6:32 PM, Bruno CARLUS <b.carlus@xxxxxxxxxxxxx> wrote:
> Hi,
>
> I have few questions as I go further in my project:
>
> - regarding bufferevent_filter: I need to retrieve udp data on a socket, filter it according to my protocol and write received data to a file. I was thinking on a read cb tranfering data (evbuffer_add_buffer or evbuffer_add_buffer_reference) from the input buffer of my bufferevent_filter to the output_buffer of another bufferevent linked to my file (mmaped). Is it the right method? How to minimize memory allocation in these operations for a high throughput?

evbuffer_add_buffer() will *moves* data from one buffer to another,
and I guess that this is pretty much what you need, while
evbuffer_add_buffer_reference() will leave a copy which you don't need
anyway (and it will use EVBUFFER_MULTICAST which will *share* the
chain between two buffers).

If you hadn't been needed filtering, you would have been able to use
EVBUFFER_SENDFILE (via evbuffer directly)

> - i read that bufferevent does not support udp yet but it seems to work in my tests (i receive data only, never send) ... What are exacly the limitations ?

Well most of the code assume that it works with stream oriented data,
for more info look at:
  http://archives.seul.org/libevent/users/Dec-2010/msg00008.html
***********************************************************************
To unsubscribe, send an e-mail to majordomo@xxxxxxxxxxxxx with
unsubscribe libevent-users    in the body.
***********************************************************************
To unsubscribe, send an e-mail to majordomo@xxxxxxxxxxxxx with
unsubscribe libevent-users    in the body.