summaryrefslogtreecommitdiff
path: root/src/or/connection.c
diff options
context:
space:
mode:
authorNick Mathewson <nickm@torproject.org>2016-11-23 09:15:51 -0500
committerNick Mathewson <nickm@torproject.org>2016-12-16 11:06:15 -0500
commitf71be7434074a1b7f8508b96cbf55cee44afb993 (patch)
treec79b3e4e04e0806a396d81b0c04996f1e917cee2 /src/or/connection.c
parent897626953b15ac216d27b3814804524caa9fdd1c (diff)
downloadtor-f71be7434074a1b7f8508b96cbf55cee44afb993.tar.gz
tor-f71be7434074a1b7f8508b96cbf55cee44afb993.zip
When freeing a guard state, cancel it if its state is unknown
We don't want a guard to stay "pending" forever if the circuit_guard_state_t for it is freed before it succeeds or fails.
Diffstat (limited to 'src/or/connection.c')
-rw-r--r--src/or/connection.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/src/or/connection.c b/src/or/connection.c
index c2a7a87d41..25c75ff101 100644
--- a/src/or/connection.c
+++ b/src/or/connection.c
@@ -634,6 +634,10 @@ connection_free_(connection_t *conn)
cached_dir_decref(dir_conn->cached_dir);
rend_data_free(dir_conn->rend_data);
+ if (dir_conn->guard_state) {
+ /* Cancel before freeing, if it's still there. */
+ entry_guard_cancel(get_guard_selection_info(), &dir_conn->guard_state);
+ }
circuit_guard_state_free(dir_conn->guard_state);
}