> -----Original Message-----
> From: [EMAIL PROTECTED]
> [mailto:[EMAIL PROTECTED] On Behalf Of Niels Provos
> Sent: Wednesday, November 01, 2006 5:34 AM
> To: Matt Pearson
> Cc: [email protected]
> Subject: Re: [Libevent-users] questions about bufferevent
>
> Hi Matt,
>
> that's about right. You get the write callback when the
> write buffer is below the watermark (which is usually 0
> bytes). You either supply more data then or disable the
> write callback. It get's automatically reneabled when you
> call bufferevent_write.
auto reenable??
i find code in evbuffer.c:300 (libevent-1.2)
------------------------
...
/* If everything is okay, we need to schedule a write */
if (size > 0 && (bufev->enabled & EV_WRITE))
bufferevent_add(&bufev->ev_write, bufev->timeout_write);
...
-----------------------
i think if i have disable the EV_WRITE in "write callback" , it can't
reenable
until i bufferevent_enable(bev,EV_WRITE) explicit .
is it right ?
thank you.
>
> Niels.
>
> On 10/31/06, Matt Pearson <[EMAIL PROTECTED]> wrote:
> > On 10/30/06, cwinl <[EMAIL PROTECTED]> wrote:
> > > i also suspect my usage of bufferevent_write.
> > > can you illustrate an example ?
> >
> > (Sorry if I mess this up; my first real mailing list post...)
> >
> > When I wrote a simple chat proxy using bufferevents, I added a
> > bufferevent_enable(EV_WRITE) in my read callback after
> writing data,
> > and then my write callback consisted of just a
> > bufferevent_disable(EV_WRITE), because otherwise the write callback
> > will keep firing because the buffer is empty, and it thinks
> you want
> > to write more. This was my thinking, anyway; I never actually
> > profiled it or anything because I wrote it in an afternoon and then
> > didn't touch it after that.
> > _______________________________________________
> > Libevent-users mailing list
> > [email protected]
> > http://monkey.org/mailman/listinfo/libevent-users
> >
> >
> _______________________________________________
> Libevent-users mailing list
> [email protected]
> http://monkey.org/mailman/listinfo/libevent-users
_______________________________________________
Libevent-users mailing list
[email protected]
http://monkey.org/mailman/listinfo/libevent-users