[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]
[Libevent-users] Re: Bufferevent filter with greedy sender
I should add: the low level read callback does eventually get called
but only after hundreds of calls to the filter's input callback. What
I'm asking for is a way to call the read callback sooner so the dst
buffer doesn't get bloated. How can I control this behavior?
On Sat, Apr 27, 2013 at 6:52 PM, kgardenia42 <kgardenia42@xxxxxxxxxxxxxx> wrote:
> Hi,
>
> I have a bufferevent_filter to parse some protocol data from the "src"
> evbuffer and unwrap it into the "dst" evbuffer.
>
> This all works fine. The problem I have, however, is that when there
> is a greedy sender sending a lot of data the input_filter just keeps
> getting called hundreds or thousands of times, massively bloating the
> dst buffer.
>
> What I would *like* to happen is for the lower level read callback (on
> the bev which is wrapped by the filter) to be called so that dst gets
> drained and I don't get the bloat.
>
> I've read the docs and I can't seem to grock this part of it and
> couldn't find a relevant example. Can someone please advise how to
> accomplish this?
>
> I see that the filter callback has a "enum bufferevent_flush_mode
> state" parameter. Is this relevant here?
>
> Thanks,
***********************************************************************
To unsubscribe, send an e-mail to majordomo@xxxxxxxxxxxxx with
unsubscribe libevent-users in the body.