[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]

Re: [Libevent-users] Stop listening on http server when accept() returns Too Many Open Files



On 2010-09-20 13:53, Nick Mathewson wrote:
>> Would the attached patch work?
> 
> Looks okay to me.   Probably, you'd want to rename "ecb" to "errorcb"
> or something; we don't use "ecb" to mean "error callback" anywhere
> else.

Sure, no problem. Also, I noticed a small typo:

-void evconnlistner_set_error_cb(struct evconnlistener *lev,
+void evconnlistener_set_error_cb(struct evconnlistener *lev,

> Is there any way to write a unit test for this?  I don't see a good
> one beyond passing in a bogus fd to provoke an ENOTSOCK or something
> like that, which is not the exact situation we're facing here, but
> which at least would make sure the callback is getting run properly.

Having no idea what your test harness is capable of, couldn't one set
ulimit -n some_low_value, start a listener, create connections until the
error callback is called, and then ...?

Simon
-- 
NAT64/DNS64 open-source --> http://ecdysis.viagenie.ca
STUN/TURN server        --> http://numb.viagenie.ca
vCard 4.0               --> http://www.vcarddav.org
***********************************************************************
To unsubscribe, send an e-mail to majordomo@xxxxxxxxxxxxx with
unsubscribe libevent-users    in the body.