diff options
author | Nick Mathewson <nickm@torproject.org> | 2012-05-15 10:22:17 -0400 |
---|---|---|
committer | Nick Mathewson <nickm@torproject.org> | 2012-06-13 16:21:06 -0400 |
commit | 9282c88998f80a027b5260472bf21125693a15bc (patch) | |
tree | 42b2743886d0a68f5121cb1c877bd8c031d77b79 /src/or/main.c | |
parent | 03b48352c6b8416faee50e769bf226b06958e253 (diff) | |
download | tor-9282c88998f80a027b5260472bf21125693a15bc.tar.gz tor-9282c88998f80a027b5260472bf21125693a15bc.zip |
Add rate-limited log message to bug5263 fix
Initially I said, "I claim that we shouldn't be reading and marked;
let's see if I'm right." But Rob finds that it does.
Diffstat (limited to 'src/or/main.c')
-rw-r--r-- | src/or/main.c | 18 |
1 files changed, 14 insertions, 4 deletions
diff --git a/src/or/main.c b/src/or/main.c index a5ad1d9648..3e913d968d 100644 --- a/src/or/main.c +++ b/src/or/main.c @@ -854,14 +854,24 @@ conn_close_if_marked(int i) will be re-added on next token bucket refill. Prevents busy Libevent loops where we keep ending up here and returning 0 until we are no longer blocked on bandwidth. */ - if (connection_is_reading(conn)) { - conn->read_blocked_on_bw = 1; - connection_stop_reading(conn); - } if (connection_is_writing(conn)) { conn->write_blocked_on_bw = 1; connection_stop_writing(conn); } + if (connection_is_reading(conn)) { +#define MARKED_READING_RATE 180 + static ratelim_t marked_read_lim = RATELIM_INIT(MARKED_READING_RATE); + char *m; + if ((m = rate_limit_log(&marked_read_lim, now))) { + log_warn(LD_BUG, "Marked connection (fd %d, type %s, state %s) " + "is still reading; that shouldn't happen.%s", + (int)conn->s, conn_type_to_string(conn->type), + conn_state_to_string(conn->type, conn->state), m); + tor_free(m); + } + conn->read_blocked_on_bw = 1; + connection_stop_reading(conn); + } } return 0; } |