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
💛 - Coveralls |
683cb91
to
eca91ff
Compare
- 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
eca91ff
to
d41c4f1
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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
Compare
8f3a3f1
to
e546a6a
Compare
42149a2
to
5b34a4d
Compare
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
Compare
test: check if GETINFO commands return expected consensus data.. docs: function docs easier to understand update: Code simplification and refactoring change
933ea85
to
f91a826
Compare
…nd type of getinfo_helper_current_consensus accepts flavor as a type(enum) consensus_flavor_t instead of plain int lint: removed unnecessary line
8234941
to
b6b38b8
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fixes made by me in #1434
No action required.
(int flav, | ||
const char *flavorname, | ||
int unverified_consensus)); | ||
tor_mmap_t * networkstatus_map_cached_consensus(const char *flavorname); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Extra space
{ | ||
const char *flavor_name = networkstatus_get_flavor_name(flavor); | ||
if (!strcmp(flavor_name, "??")) { | ||
*errmsg = "Could not open cached consensus. " |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Wrong error message
return -1; | ||
} | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Weird spacing?
@@ -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."), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Typo
dirserv_get_consensus(const char *flavor_name) | ||
MOCK_IMPL(cached_dir_t *, | ||
dirserv_get_consensus, | ||
(const char *flavor_name)) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Spacing
} else if (!strcmp(question, "dir/status-vote/current/consensus")) { | ||
int consensus_result = getinfo_helper_current_consensus(FLAV_NS, | ||
answer, errmsg); | ||
if (consensus_result == -1) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We use < 0
const char *errmsg = NULL; | ||
|
||
(void)arg; | ||
setup_bridge_mocks(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not needed
tor_free(mock_microdesc_consensus_cache->dir); | ||
tor_free(answer); | ||
errmsg = NULL; | ||
options->FetchUselessDescriptors = previous_fetch_value; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should be after done:
(void)arg; | ||
setup_bridge_mocks(); | ||
or_options_t *options = get_options_mutable(); | ||
int previous_fetch_value = options->FetchUselessDescriptors; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not needed
options->FetchUselessDescriptors = previous_fetch_value; | ||
|
||
done: | ||
clear_bridge_mocks(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not needed
Latest code in #1434. |
Add control port GETINFO support for dumping the local consensus
Refer: (ticket)[https://trac.torproject.org/projects/tor/ticket/31684]