On Thu, Feb 10, 2011 at 4:27 PM, Constantine Verutin <[email protected]> wrote: > Hi guys, > > I noticed that evhttp_accept_socket_with_handle() sets the > LEV_OPT_CLOSE_ON_FREE flag on underlying evconnlistener, and in this case > calling evhttp_del_accept_socket() later causes socket fd to be freed(while > documentation explicitly says this function does not close). Is this a bug? > Or I should create evconnlistener manually and use evhttp_bind_listener?
Well, something's certainly wrong here. I'm not sure whether to call it a bug in the documentation or a bug in the code. My inclination is to call the code correct and change the doxygen comment from "This function does not close the socket" to "This function closes the socket if you created the evhttp_bound_socket using evhttp_bind_socket_with_handle or evhttp_accept_socket_with_handle. This function frees the listener you provided if you created the socket using evhttp_bind_listener." My rationale is that if we change the code, we risk introducing socket leaks to programs that previously didn't have them, whereas any programs that followed the documentation in this case would not get any buggier than they were before. I could be wrong, though. Anybody want to talk me out of it? (I am not proposing this as a general rule for future cases where code and docs differ. ;) ) -- Nick *********************************************************************** To unsubscribe, send an e-mail to [email protected] with unsubscribe libevent-users in the body.
