diff options
author | Nick Mathewson <nickm@torproject.org> | 2012-06-22 22:33:14 -0400 |
---|---|---|
committer | Nick Mathewson <nickm@torproject.org> | 2012-06-22 22:33:14 -0400 |
commit | a9de982c343b0d83078d8e46b1a06e483c8595ec (patch) | |
tree | d91387e26004c6c6a5fde33babfc538ac0b2dc6f /src | |
parent | 4a7e4129af6db990b9672b6d4f013b2e59aa81b7 (diff) | |
parent | 0600e8cab17d2128d663b31d93b93ddc1ab95ee2 (diff) | |
download | tor-a9de982c343b0d83078d8e46b1a06e483c8595ec.tar tor-a9de982c343b0d83078d8e46b1a06e483c8595ec.tar.gz |
Merge remote-tracking branch 'public/bug6203_v2' into maint-0.2.3
Diffstat (limited to 'src')
-rw-r--r-- | src/or/main.c | 13 |
1 files changed, 12 insertions, 1 deletions
diff --git a/src/or/main.c b/src/or/main.c index f8740d7b2..1f3117b23 100644 --- a/src/or/main.c +++ b/src/or/main.c @@ -848,7 +848,10 @@ conn_close_if_marked(int i) "Holding conn (fd %d) open for more flushing.", (int)conn->s)); conn->timestamp_lastwritten = now; /* reset so we can flush more */ - } else if (sz == 0) { /* retval is also 0 */ + } else if (sz == 0) { + /* Also, retval==0. If we get here, we didn't want to write anything + * (because of rate-limiting) and we didn't. */ + /* Connection must flush before closing, but it's being rate-limited. * Let's remove from Libevent, and mark it as blocked on bandwidth * so it will be re-added on next token bucket refill. Prevents @@ -860,6 +863,13 @@ conn_close_if_marked(int i) connection_stop_writing(conn); } if (connection_is_reading(conn)) { + /* XXXX024 We should make this code unreachable; if a connection is + * marked for close and flushing, there is no point in reading to it + * at all. Further, checking at this point is a bit of a hack: it + * would make much more sense to react in + * connection_handle_read_impl, or to just stop reading in + * mark_and_flush */ +#if 0 #define MARKED_READING_RATE 180 static ratelim_t marked_read_lim = RATELIM_INIT(MARKED_READING_RATE); char *m; @@ -870,6 +880,7 @@ conn_close_if_marked(int i) conn_state_to_string(conn->type, conn->state), m); tor_free(m); } +#endif conn->read_blocked_on_bw = 1; connection_stop_reading(conn); } |