From df3bdc6bdeb7e8eef13248ba245a70fd8cbf1f86 Mon Sep 17 00:00:00 2001 From: Nick Mathewson Date: Mon, 31 Jul 2017 20:35:58 -0400 Subject: Clean up choose_good_entry_server() doc; add assertion We used to allow state==NULL here, but we no longer do. Fixes bug 22779. --- src/or/circuitbuild.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) (limited to 'src/or/circuitbuild.c') diff --git a/src/or/circuitbuild.c b/src/or/circuitbuild.c index 16cef0e56b..f7dc7cbc6a 100644 --- a/src/or/circuitbuild.c +++ b/src/or/circuitbuild.c @@ -2358,9 +2358,6 @@ choose_good_middle_server(uint8_t purpose, * router (if we're an OR), and respect firewall settings; if we're * configured to use entry guards, return one. * - * If state is NULL, we're choosing a router to serve as an entry - * guard, not for any particular circuit. - * * Set *guard_state_out to information about the guard that * we're selecting, which we'll use later to remember whether the * guard worked or not. @@ -2378,6 +2375,11 @@ choose_good_entry_server(uint8_t purpose, cpath_build_state_t *state, CRN_DIRECT_CONN); const node_t *node; + /* Once we used this function to select a node to be a guard. We had + * 'state == NULL' be the signal for that. But we don't do that any more. + */ + tor_assert_nonfatal(state); + if (state && options->UseEntryGuards && (purpose != CIRCUIT_PURPOSE_TESTING || options->BridgeRelay)) { /* This request is for an entry server to use for a regular circuit, -- cgit v1.2.3-54-g00ecf