torproject / tor Public
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Ticket31684 #1328
Ticket31684 #1328
Conversation
Pull Request Test Coverage Report for Build 6594
|
683cb91
to
eca91ff
- Allows control port to read microdesc consensus using: GETINFO dir/status-vote/microdesc/consensus refer: [ticket](https://trac.torproject.org/projects/tor/ticket/31684) refer: [comment](https://trac.torproject.org/projects/tor/ticket/31684#comment:6) add: Helper function `getinfo_helper_current_consensus` add(changes/ticket31684): track changes within ticket31684 fix(changes/ticket31684): formatting and ticket#number refactor: remove redundant conditionals fix: getinfo_helper_current_consensus returns -1 for any question that doesn't ask for microdesc or ns descriptors lint: wide condition
OK here is a review. Also please change the commit message to specify what the changes did, instead of which trac ticket they fixed. Example "Add GETINFO support for dumping microdesc consensus".
3d18911
to
e8a060d
8f3a3f1
to
e546a6a
42149a2
to
5b34a4d
|
It seems like you're pushing a lot of commits here. Or maybe this task isn't a good fit for you. |
|
I'll take it off on a separate branch and use the CI on my fork. I assumed I'd get this done faster but I should have done this before. Sincere apologies. |
a4ebfbc
to
933ea85
test: check if GETINFO commands return expected consensus data.. docs: function docs easier to understand update: Code simplification and refactoring change
…nd type of getinfo_helper_current_consensus accepts flavor as a type(enum) consensus_flavor_t instead of plain int lint: removed unnecessary line
| (int flav, | ||
| const char *flavorname, | ||
| int unverified_consensus)); | ||
| tor_mmap_t * networkstatus_map_cached_consensus(const char *flavorname); |
| { | ||
| const char *flavor_name = networkstatus_get_flavor_name(flavor); | ||
| if (!strcmp(flavor_name, "??")) { | ||
| *errmsg = "Could not open cached consensus. " |
| return -1; | ||
| } | ||
| } |
| @@ -1513,6 +1544,8 @@ static const getinfo_item_t getinfo_items[] = { | |||
| "v2 networkstatus docs as retrieved from a DirPort."), | |||
| ITEM("dir/status-vote/current/consensus", dir, | |||
| "v3 Networkstatus consensus as retrieved from a DirPort."), | |||
| ITEM("dir/status-vote/current/consensus-microdesc", dir, | |||
| "v3 Microdescriptors consensus as retrieved from a DirPort."), | |||
| dirserv_get_consensus(const char *flavor_name) | ||
| MOCK_IMPL(cached_dir_t *, | ||
| dirserv_get_consensus, | ||
| (const char *flavor_name)) |
| } else if (!strcmp(question, "dir/status-vote/current/consensus")) { | ||
| int consensus_result = getinfo_helper_current_consensus(FLAV_NS, | ||
| answer, errmsg); | ||
| if (consensus_result == -1) { |
| const char *errmsg = NULL; | ||
|
|
||
| (void)arg; | ||
| setup_bridge_mocks(); |
| tor_free(mock_microdesc_consensus_cache->dir); | ||
| tor_free(answer); | ||
| errmsg = NULL; | ||
| options->FetchUselessDescriptors = previous_fetch_value; |
| (void)arg; | ||
| setup_bridge_mocks(); | ||
| or_options_t *options = get_options_mutable(); | ||
| int previous_fetch_value = options->FetchUselessDescriptors; |
| options->FetchUselessDescriptors = previous_fetch_value; | ||
|
|
||
| done: | ||
| clear_bridge_mocks(); |
|
Latest code in #1434. |
Add control port GETINFO support for dumping the local consensus
Refer: (ticket)[https://trac.torproject.org/projects/tor/ticket/31684]
The text was updated successfully, but these errors were encountered: