Re: [Libevent-users] Callback after all events from the current batch have been cleared

2012-06-27 Thread Zack Weinberg
On 2012-06-27 11:26 AM, Zack Weinberg wrote: The only bufferevent type we use is socket bufferevents, created variously with bufferevent_socket_connect(_hostname) and bufferevent_socket_new; the latter case uses the fd provided to the callback of an evconnlistener. We also use evconnlisteners, t

Re: [Libevent-users] Callback after all events from the current batch have been cleared

2012-06-27 Thread Zack Weinberg
On Tue, Jun 26, 2012 at 4:07 PM, Nick Mathewson wrote: > On Jun 26, 2012 3:08 PM, "Zack Weinberg" wrote: >> By "deferred callbacks" do you mean the implementation of >> BEV_OPT_DEFER_CALLBACKS, or something else?  This program doesn't use >> that, although maybe it should (I'm not at all clear on

Re: [Libevent-users] Callback after all events from the current batch have been cleared

2012-06-26 Thread Nick Mathewson
On Jun 26, 2012 3:08 PM, "Zack Weinberg" wrote: > > On Tue, Jun 26, 2012 at 8:41 AM, Nick Mathewson wrote: > > It will work only so long as there are no "deferred callbacks" queued. > > By "deferred callbacks" do you mean the implementation of > BEV_OPT_DEFER_CALLBACKS, or something else? This p

Re: [Libevent-users] Callback after all events from the current batch have been cleared

2012-06-26 Thread Zack Weinberg
On Tue, Jun 26, 2012 at 8:41 AM, Nick Mathewson wrote: > On Mon, Jun 25, 2012 at 1:20 PM, Zack Weinberg wrote: >> I *think* this can be done with a timer event which is assigned a lower >> priority than all other events in the program, and which is event_add()ed >> with an immediate timeout whene

Re: [Libevent-users] Callback after all events from the current batch have been cleared

2012-06-26 Thread Nick Mathewson
On Tue, Jun 26, 2012 at 11:41 AM, Nick Mathewson wrote: > On Mon, Jun 25, 2012 at 1:20 PM, Zack Weinberg wrote: [...] >> I *think* this can be done with a timer event which is assigned a lower >> priority than all other events in the program, and which is event_add()ed >> with an immediate timeo

Re: [Libevent-users] Callback after all events from the current batch have been cleared

2012-06-26 Thread Nick Mathewson
On Mon, Jun 25, 2012 at 1:20 PM, Zack Weinberg wrote: > I'm looking at a bug which appears to come down to: some of my event > callbacks deallocate events, bufferevents, and/or their callback data. Under > difficult-to-reproduce circumstances, libevent appears to queue up calls to > my callbacks (

[Libevent-users] Callback after all events from the current batch have been cleared

2012-06-25 Thread Zack Weinberg
I'm looking at a bug which appears to come down to: some of my event callbacks deallocate events, bufferevents, and/or their callback data. Under difficult-to-reproduce circumstances, libevent appears to queue up calls to my callbacks (possibly implicitly via internal control flow), and call th