From 30422b5df1cdad92460d6934d1f9c7b2474a6f0d Mon Sep 17 00:00:00 2001 From: Nick Mathewson Date: Sat, 9 Aug 2008 15:35:37 +0000 Subject: [PATCH] Rate-limit "too-many-sockets" messages; they can get needlessly verbose. svn:r16480 --- ChangeLog | 4 ++++ src/or/connection.c | 2 +- 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/ChangeLog b/ChangeLog index 9b41b39391..b9e4a1d224 100644 --- a/ChangeLog +++ b/ChangeLog @@ -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. - 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 o Major bugfixes: diff --git a/src/or/connection.c b/src/or/connection.c index 3b032eddd1..64b866748c 100644 --- a/src/or/connection.c +++ b/src/or/connection.c @@ -762,8 +762,8 @@ warn_too_many_conns(void) { #define WARN_TOO_MANY_CONNS_INTERVAL (6*60*60) time_t last_warned = 0, now = time(NULL); + int n_conns = get_n_open_sockets(); 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 " "raise your ulimit -n.", n_conns); last_warned = now;