mirror of
https://gitlab.torproject.org/tpo/core/tor.git
synced 2024-11-11 13:43:47 +01:00
Remove GS_TYPE_LEGACY
This commit is contained in:
parent
a31a5581ee
commit
6d03e36fd0
@ -199,9 +199,7 @@ guard_selection_infer_type(guard_selection_type_t type,
|
|||||||
const char *name)
|
const char *name)
|
||||||
{
|
{
|
||||||
if (type == GS_TYPE_INFER) {
|
if (type == GS_TYPE_INFER) {
|
||||||
if (!strcmp(name, "legacy"))
|
if (!strcmp(name, "bridges"))
|
||||||
type = GS_TYPE_LEGACY;
|
|
||||||
else if (!strcmp(name, "bridges"))
|
|
||||||
type = GS_TYPE_BRIDGE;
|
type = GS_TYPE_BRIDGE;
|
||||||
else if (!strcmp(name, "restricted"))
|
else if (!strcmp(name, "restricted"))
|
||||||
type = GS_TYPE_RESTRICTED;
|
type = GS_TYPE_RESTRICTED;
|
||||||
@ -3100,8 +3098,7 @@ entry_guards_update_state(or_state_t *state)
|
|||||||
* Return a newly allocated string.
|
* Return a newly allocated string.
|
||||||
*/
|
*/
|
||||||
STATIC char *
|
STATIC char *
|
||||||
getinfo_helper_format_single_entry_guard(const entry_guard_t *e,
|
getinfo_helper_format_single_entry_guard(const entry_guard_t *e)
|
||||||
int legacy_guard)
|
|
||||||
{
|
{
|
||||||
const char *status = NULL;
|
const char *status = NULL;
|
||||||
time_t when = 0;
|
time_t when = 0;
|
||||||
@ -3109,10 +3106,7 @@ getinfo_helper_format_single_entry_guard(const entry_guard_t *e,
|
|||||||
char tbuf[ISO_TIME_LEN+1];
|
char tbuf[ISO_TIME_LEN+1];
|
||||||
char nbuf[MAX_VERBOSE_NICKNAME_LEN+1];
|
char nbuf[MAX_VERBOSE_NICKNAME_LEN+1];
|
||||||
|
|
||||||
if (legacy_guard) {
|
if (1) {
|
||||||
tor_assert_nonfatal_unreached();
|
|
||||||
status = "BUG";
|
|
||||||
} else {
|
|
||||||
/* modern case. This is going to be a bit tricky, since the status
|
/* modern case. This is going to be a bit tricky, since the status
|
||||||
* codes above weren't really intended for prop271 guards.
|
* codes above weren't really intended for prop271 guards.
|
||||||
*
|
*
|
||||||
@ -3177,19 +3171,12 @@ getinfo_helper_entry_guards(control_connection_t *conn,
|
|||||||
if (!strcmp(question,"entry-guards") ||
|
if (!strcmp(question,"entry-guards") ||
|
||||||
!strcmp(question,"helper-nodes")) {
|
!strcmp(question,"helper-nodes")) {
|
||||||
const smartlist_t *guards;
|
const smartlist_t *guards;
|
||||||
int legacy_mode;
|
|
||||||
if (gs->type == GS_TYPE_LEGACY) {
|
|
||||||
tor_assert_nonfatal_unreached();
|
|
||||||
return 0;
|
|
||||||
} else {
|
|
||||||
guards = gs->sampled_entry_guards;
|
guards = gs->sampled_entry_guards;
|
||||||
legacy_mode = 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
smartlist_t *sl = smartlist_new();
|
smartlist_t *sl = smartlist_new();
|
||||||
|
|
||||||
SMARTLIST_FOREACH_BEGIN(guards, const entry_guard_t *, e) {
|
SMARTLIST_FOREACH_BEGIN(guards, const entry_guard_t *, e) {
|
||||||
char *cp = getinfo_helper_format_single_entry_guard(e, legacy_mode);
|
char *cp = getinfo_helper_format_single_entry_guard(e);
|
||||||
smartlist_add(sl, cp);
|
smartlist_add(sl, cp);
|
||||||
} SMARTLIST_FOREACH_END(e);
|
} SMARTLIST_FOREACH_END(e);
|
||||||
*answer = smartlist_join_strings(sl, "", 0, NULL);
|
*answer = smartlist_join_strings(sl, "", 0, NULL);
|
||||||
@ -3248,12 +3235,8 @@ guards_update_all(void)
|
|||||||
|
|
||||||
tor_assert(curr_guard_context);
|
tor_assert(curr_guard_context);
|
||||||
|
|
||||||
if (curr_guard_context->type == GS_TYPE_LEGACY) {
|
|
||||||
tor_assert_nonfatal_unreached();
|
|
||||||
} else {
|
|
||||||
if (entry_guards_update_all(curr_guard_context))
|
if (entry_guards_update_all(curr_guard_context))
|
||||||
mark_circuits = 1;
|
mark_circuits = 1;
|
||||||
}
|
|
||||||
|
|
||||||
return mark_circuits;
|
return mark_circuits;
|
||||||
}
|
}
|
||||||
|
@ -194,8 +194,6 @@ typedef enum guard_selection_type_t {
|
|||||||
/** Use the normal guard selection algorithm, taking our sample from the
|
/** Use the normal guard selection algorithm, taking our sample from the
|
||||||
* set of filtered nodes. */
|
* set of filtered nodes. */
|
||||||
GS_TYPE_RESTRICTED,
|
GS_TYPE_RESTRICTED,
|
||||||
/** Use the legacy (pre-prop271) guard selection algorithm and fields */
|
|
||||||
GS_TYPE_LEGACY,
|
|
||||||
} guard_selection_type_t;
|
} guard_selection_type_t;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -548,8 +546,7 @@ STATIC unsigned entry_guards_note_guard_success(guard_selection_t *gs,
|
|||||||
entry_guard_t *guard,
|
entry_guard_t *guard,
|
||||||
unsigned old_state);
|
unsigned old_state);
|
||||||
STATIC int entry_guard_has_higher_priority(entry_guard_t *a, entry_guard_t *b);
|
STATIC int entry_guard_has_higher_priority(entry_guard_t *a, entry_guard_t *b);
|
||||||
STATIC char *getinfo_helper_format_single_entry_guard(const entry_guard_t *e,
|
STATIC char *getinfo_helper_format_single_entry_guard(const entry_guard_t *e);
|
||||||
int is_legacy);
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
struct bridge_info_t;
|
struct bridge_info_t;
|
||||||
|
@ -747,9 +747,6 @@ test_entry_guard_parse_from_state_broken(void *arg)
|
|||||||
gs_df = get_guard_selection_by_name("default", GS_TYPE_NORMAL, 0);
|
gs_df = get_guard_selection_by_name("default", GS_TYPE_NORMAL, 0);
|
||||||
tt_assert(gs_df != NULL);
|
tt_assert(gs_df != NULL);
|
||||||
tt_int_op(smartlist_len(gs_df->sampled_entry_guards), OP_EQ, 1);
|
tt_int_op(smartlist_len(gs_df->sampled_entry_guards), OP_EQ, 1);
|
||||||
guard_selection_t *gs_legacy =
|
|
||||||
get_guard_selection_by_name("legacy", GS_TYPE_LEGACY, 0);
|
|
||||||
tt_assert(gs_legacy == NULL);
|
|
||||||
|
|
||||||
done:
|
done:
|
||||||
config_free_lines(lines);
|
config_free_lines(lines);
|
||||||
|
Loading…
Reference in New Issue
Block a user