mirror of
https://gitlab.torproject.org/tpo/core/tor.git
synced 2024-11-19 18:00:33 +01:00
Add GETINFO targets to determine whether md/desc fetching is enabled
Closes ticket 22684.
This commit is contained in:
parent
5d3f484f4a
commit
5dcc6bef1e
5
changes/ticket22684
Normal file
5
changes/ticket22684
Normal file
@ -0,0 +1,5 @@
|
||||
o Minor features (control):
|
||||
- Add GETINFO desc/download-enabled and md/download-enabled, to
|
||||
inform the controller whether try to download router descriptors
|
||||
and microdescriptors respectively. Closes ticket 22684.
|
||||
|
@ -1919,6 +1919,9 @@ getinfo_helper_dir(control_connection_t *control_conn,
|
||||
"instead of desc/name/*.";
|
||||
return 0;
|
||||
}
|
||||
} else if (!strcmp(question, "desc/download-enabled")) {
|
||||
int r = we_fetch_router_descriptors(get_options());
|
||||
tor_asprintf(answer, "%d", !!r);
|
||||
} else if (!strcmp(question, "desc/all-recent")) {
|
||||
routerlist_t *routerlist = router_get_routerlist();
|
||||
smartlist_t *sl = smartlist_new();
|
||||
@ -2004,6 +2007,9 @@ getinfo_helper_dir(control_connection_t *control_conn,
|
||||
if (md && md->body) {
|
||||
*answer = tor_strndup(md->body, md->bodylen);
|
||||
}
|
||||
} else if (!strcmp(question, "md/download-enabled")) {
|
||||
int r = we_fetch_microdescriptors(get_options());
|
||||
tor_asprintf(answer, "%d", !!r);
|
||||
} else if (!strcmpstart(question, "desc-annotations/id/")) {
|
||||
const routerinfo_t *ri = NULL;
|
||||
const node_t *node =
|
||||
@ -3026,9 +3032,13 @@ static const getinfo_item_t getinfo_items[] = {
|
||||
PREFIX("desc/name/", dir, "Router descriptors by nickname."),
|
||||
ITEM("desc/all-recent", dir,
|
||||
"All non-expired, non-superseded router descriptors."),
|
||||
ITEM("desc/download-enabled", dir,
|
||||
"Do we try to download router descriptors?"),
|
||||
ITEM("desc/all-recent-extrainfo-hack", dir, NULL), /* Hack. */
|
||||
PREFIX("md/id/", dir, "Microdescriptors by ID"),
|
||||
PREFIX("md/name/", dir, "Microdescriptors by name"),
|
||||
ITEM("md/download-enabled", dir,
|
||||
"Do we try to download microdescriptors?"),
|
||||
PREFIX("extra-info/digest/", dir, "Extra-info documents by digest."),
|
||||
PREFIX("hs/client/desc/id", dir,
|
||||
"Hidden Service descriptor in client's cache by onion."),
|
||||
|
Loading…
Reference in New Issue
Block a user