From 18183de0609a45a92b69d00e37ab569921e63413 Mon Sep 17 00:00:00 2001 From: Nick Mathewson Date: Tue, 21 Aug 2018 09:50:48 -0400 Subject: [PATCH 1/2] Check for duplicate-close in connection_dir_finished_flusing() Fix for 26896. --- changes/bug26896 | 3 +++ src/or/directory.c | 4 +++- 2 files changed, 6 insertions(+), 1 deletion(-) create mode 100644 changes/bug26896 diff --git a/changes/bug26896 b/changes/bug26896 new file mode 100644 index 0000000000..9762dc7fac --- /dev/null +++ b/changes/bug26896 @@ -0,0 +1,3 @@ + o Minor bugfixes (directory connection shutdown): + - Avoid a double-close when shutting down a stalled directory connection. + Fixes bug 26896; bugfix on 0.3.4.1-alpha. diff --git a/src/or/directory.c b/src/or/directory.c index e763de268f..32ec876f78 100644 --- a/src/or/directory.c +++ b/src/or/directory.c @@ -5179,6 +5179,9 @@ connection_dir_finished_flushing(dir_connection_t *conn) tor_assert(conn); tor_assert(conn->base_.type == CONN_TYPE_DIR); + if (conn->marked_for_close) + return 0; + /* Note that we have finished writing the directory response. For direct * connections this means we're done; for tunneled connections it's only * an intermediate step. */ @@ -5912,4 +5915,3 @@ dir_split_resource_into_spoolable(const char *resource, smartlist_free(fingerprints); return r; } - From 21a9d034455a9c302055524a9d4dccbfddb220f2 Mon Sep 17 00:00:00 2001 From: Nick Mathewson Date: Tue, 21 Aug 2018 11:15:07 -0400 Subject: [PATCH 2/2] fixup! Check for duplicate-close in connection_dir_finished_flusing() --- src/or/directory.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/or/directory.c b/src/or/directory.c index 32ec876f78..ca53756cbe 100644 --- a/src/or/directory.c +++ b/src/or/directory.c @@ -5179,7 +5179,7 @@ connection_dir_finished_flushing(dir_connection_t *conn) tor_assert(conn); tor_assert(conn->base_.type == CONN_TYPE_DIR); - if (conn->marked_for_close) + if (conn->base_.marked_for_close) return 0; /* Note that we have finished writing the directory response. For direct