diff options
author | Nick Mathewson <nickm@torproject.org> | 2013-02-07 17:13:51 -0500 |
---|---|---|
committer | Nick Mathewson <nickm@torproject.org> | 2013-02-07 17:13:51 -0500 |
commit | 3433216268a97f8c1595fd389da0e960e8074d32 (patch) | |
tree | 059f7b25c662162f1015fb5cafd82d2010754d65 /src/or | |
parent | e5b07ba17947ba4782cbac8f12de7024b2969c99 (diff) | |
parent | a7334f5122046b55a5eff425cdaaa3e56c5defed (diff) | |
download | tor-3433216268a97f8c1595fd389da0e960e8074d32.tar.gz tor-3433216268a97f8c1595fd389da0e960e8074d32.zip |
Merge remote-tracking branch 'public/easy_ratelim'
Conflicts:
src/or/connection.c
Diffstat (limited to 'src/or')
-rw-r--r-- | src/or/buffers.c | 11 | ||||
-rw-r--r-- | src/or/circuituse.c | 10 | ||||
-rw-r--r-- | src/or/connection.c | 7 | ||||
-rw-r--r-- | src/or/router.c | 9 |
4 files changed, 12 insertions, 25 deletions
diff --git a/src/or/buffers.c b/src/or/buffers.c index e5fac9172d..73c25579d6 100644 --- a/src/or/buffers.c +++ b/src/or/buffers.c @@ -1505,22 +1505,19 @@ log_unsafe_socks_warning(int socks_protocol, const char *address, static ratelim_t socks_ratelim = RATELIM_INIT(SOCKS_WARN_INTERVAL); const or_options_t *options = get_options(); - char *m = NULL; if (! options->WarnUnsafeSocks) return; - if (safe_socks || (m = rate_limit_log(&socks_ratelim, approx_time()))) { - log_warn(LD_APP, + if (safe_socks) { + log_fn_ratelim(&socks_ratelim, LOG_WARN, LD_APP, "Your application (using socks%d to port %d) is giving " "Tor only an IP address. Applications that do DNS resolves " "themselves may leak information. Consider using Socks4A " "(e.g. via privoxy or socat) instead. For more information, " "please see https://wiki.torproject.org/TheOnionRouter/" - "TorFAQ#SOCKSAndDNS.%s%s", + "TorFAQ#SOCKSAndDNS.%s", socks_protocol, (int)port, - safe_socks ? " Rejecting." : "", - m ? m : ""); - tor_free(m); + safe_socks ? " Rejecting." : ""); } control_event_client_status(LOG_WARN, "DANGEROUS_SOCKS PROTOCOL=SOCKS%d ADDRESS=%s:%d", diff --git a/src/or/circuituse.c b/src/or/circuituse.c index cfd41be792..c0612039be 100644 --- a/src/or/circuituse.c +++ b/src/or/circuituse.c @@ -540,17 +540,13 @@ circuit_expire_building(void) continue; } else { static ratelim_t relax_timeout_limit = RATELIM_INIT(3600); - char *m; - if ((m = rate_limit_log(&relax_timeout_limit, approx_time()))) { - log_notice(LD_CIRC, + log_fn_ratelim(&relax_timeout_limit, LOG_NOTICE, LD_CIRC, "No circuits are opened. Relaxed timeout for " "a circuit with channel state %s to %ldms. " "However, it appears the circuit has timed out anyway. " - "%d guards are live. %s", + "%d guards are live.", channel_state_to_string(victim->n_chan->state), - (long)circ_times.close_ms, num_live_entry_guards(0), m); - tor_free(m); - } + (long)circ_times.close_ms, num_live_entry_guards(0)); } } diff --git a/src/or/connection.c b/src/or/connection.c index d0602fde24..7b0f081fde 100644 --- a/src/or/connection.c +++ b/src/or/connection.c @@ -1444,12 +1444,9 @@ connection_connect(connection_t *conn, const char *address, /* We should never even try to connect anyplace if DisableNetwork is set. * Warn if we do, and refuse to make the connection. */ static ratelim_t disablenet_violated = RATELIM_INIT(30*60); - char *m; *socket_error = SOCK_ERRNO(ENETUNREACH); - if ((m = rate_limit_log(&disablenet_violated, approx_time()))) { - log_warn(LD_BUG, "Tried to open a socket with DisableNetwork set.%s", m); - tor_free(m); - } + log_fn_ratelim(&disablenet_violated, LOG_WARN, LD_BUG, + "Tried to open a socket with DisableNetwork set."); tor_fragile_assert(); return -1; } diff --git a/src/or/router.c b/src/or/router.c index b52632c581..3fd8b3c070 100644 --- a/src/or/router.c +++ b/src/or/router.c @@ -1117,14 +1117,11 @@ consider_testing_reachability(int test_or, int test_dir) if (test_or || test_dir) { #define SELF_EXCLUDED_WARN_INTERVAL 3600 static ratelim_t warning_limit=RATELIM_INIT(SELF_EXCLUDED_WARN_INTERVAL); - char *msg; - if ((msg = rate_limit_log(&warning_limit, approx_time()))) { - log_warn(LD_CIRC, "Can't peform self-tests for this relay: we have " + log_fn_ratelim(&warning_limit, LOG_WARN, LD_CIRC, + "Can't peform self-tests for this relay: we have " "listed ourself in ExcludeNodes, and StrictNodes is set. " "We cannot learn whether we are usable, and will not " - "be able to advertise ourself.%s", msg); - tor_free(msg); - } + "be able to advertise ourself."); } return; } |