summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNick Mathewson <nickm@torproject.org>2019-01-04 14:34:38 -0500
committerNick Mathewson <nickm@torproject.org>2019-01-04 14:34:38 -0500
commitd47c9276de69ee206670844b4032965fbb497d3b (patch)
tree02a8a1bac90c9e0588e28fb859c44c55493d720b
parent3e64553f769a4d2536c9f0ac0ad289cf9c41826d (diff)
parentc99f220f7857e40bd9c09bd0c240b3b9aea4d6f8 (diff)
downloadtor-d47c9276de69ee206670844b4032965fbb497d3b.tar.gz
tor-d47c9276de69ee206670844b4032965fbb497d3b.zip
Merge branch 'ticket27750_034_01_squashed' into maint-0.3.4
-rw-r--r--changes/bug277506
-rw-r--r--src/or/main.c17
2 files changed, 12 insertions, 11 deletions
diff --git a/changes/bug27750 b/changes/bug27750
new file mode 100644
index 0000000000..c234788b1c
--- /dev/null
+++ b/changes/bug27750
@@ -0,0 +1,6 @@
+ o Minor bugfixes (connection, relay):
+ - Avoid a wrong BUG() stacktrace in case a closing connection is being held
+ open because the write side is rate limited but not the read side. Now,
+ the connection read side is simply shutdown instead of kept open until tor
+ is able to flush the connection and then fully close it. Fixes bug 27750;
+ bugfix on 0.3.4.1-alpha.
diff --git a/src/or/main.c b/src/or/main.c
index aaa31c0579..c69a5b8b8b 100644
--- a/src/or/main.c
+++ b/src/or/main.c
@@ -1047,23 +1047,18 @@ conn_close_if_marked(int i)
* busy Libevent loops where we keep ending up here and returning
* 0 until we are no longer blocked on bandwidth.
*/
- connection_consider_empty_read_buckets(conn);
connection_consider_empty_write_buckets(conn);
-
/* Make sure that consider_empty_buckets really disabled the
* connection: */
if (BUG(connection_is_writing(conn))) {
connection_write_bw_exhausted(conn, true);
}
- if (BUG(connection_is_reading(conn))) {
- /* XXXX+ 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 */
- connection_read_bw_exhausted(conn, true/* kludge. */);
- }
+
+ /* The connection is being held due to write rate limit and thus will
+ * flush its data later. We need to stop reading because this
+ * connection is about to be closed once flushed. It should not
+ * process anything more coming in at this stage. */
+ connection_stop_reading(conn);
}
return 0;
}