On Sun, Jul 2, 2017 at 8:52 PM, Dan Moore <[email protected]> wrote: > I think I need a function named bufferevent_free_setcb(). It would run after > all of the other queued events for the fd. > > I have a stateful protocol, and when I ditch a connection with > bufferevent_free(), callbacks still run that reference my context structure. > I understand why this is happening, but it means that I have to guess how > long I should wait and then add a timer event to free the context.
Hi Dan, bufferevent_free() will not free the bufferevent if it is still in use, and if your callback executed the it is in use (regardless is it deferred callback or not). And also bufferevent_free() resets all callbacks (regardless it is in use or not, to make free possible once all ref counts decremented to zero). So you should guess and wait, it will be freed once refcnt will be zero. Can you elaborate your problem? (Or provide a reproducer which will show the problem). *********************************************************************** To unsubscribe, send an e-mail to [email protected] with unsubscribe libevent-users in the body.
