Rate-limit "too-many-sockets" messages; they can get needlessly verbose.

svn:r16480
This commit is contained in:
Nick Mathewson 2008-08-09 15:35:37 +00:00
parent 60a0ae198d
commit 30422b5df1
2 changed files with 5 additions and 1 deletions

View File

@ -18,6 +18,10 @@ Changes in version 0.2.1.5-alpha - 2008-08-??
when building against recent kernels. Bugfix on 0.1.2.1-alpha. when building against recent kernels. Bugfix on 0.1.2.1-alpha.
- Add a missing safe_str() call for a debug log message. - Add a missing safe_str() call for a debug log message.
o Minor features
- Rate-limit too-many-sockets messages: when they happen, they
happen a lot. Resolves bug 748.
Changes in version 0.2.1.4-alpha - 2008-08-04 Changes in version 0.2.1.4-alpha - 2008-08-04
o Major bugfixes: o Major bugfixes:

View File

@ -762,8 +762,8 @@ warn_too_many_conns(void)
{ {
#define WARN_TOO_MANY_CONNS_INTERVAL (6*60*60) #define WARN_TOO_MANY_CONNS_INTERVAL (6*60*60)
time_t last_warned = 0, now = time(NULL); time_t last_warned = 0, now = time(NULL);
int n_conns = get_n_open_sockets();
if (last_warned + WARN_TOO_MANY_CONNS_INTERVAL < now) { if (last_warned + WARN_TOO_MANY_CONNS_INTERVAL < now) {
int n_conns = get_n_open_sockets();
log_warn(LD_NET,"Failing because we have %d connections already. Please " log_warn(LD_NET,"Failing because we have %d connections already. Please "
"raise your ulimit -n.", n_conns); "raise your ulimit -n.", n_conns);
last_warned = now; last_warned = now;