mirror of
https://gitlab.torproject.org/tpo/core/tor.git
synced 2024-12-03 17:13:33 +01:00
Merge remote-tracking branch 'teor/bug24489'
This commit is contained in:
commit
91f72bbb6c
3
changes/bug24489
Normal file
3
changes/bug24489
Normal file
@ -0,0 +1,3 @@
|
|||||||
|
o Code simplification and refactoring (controller):
|
||||||
|
- Make most of the variables in networkstatus_getinfo_by_purpose() const.
|
||||||
|
Implements ticket 24489.
|
@ -2224,13 +2224,13 @@ networkstatus_getinfo_helper_single(const routerstatus_t *rs)
|
|||||||
char *
|
char *
|
||||||
networkstatus_getinfo_by_purpose(const char *purpose_string, time_t now)
|
networkstatus_getinfo_by_purpose(const char *purpose_string, time_t now)
|
||||||
{
|
{
|
||||||
time_t cutoff = now - ROUTER_MAX_AGE_TO_PUBLISH;
|
const time_t cutoff = now - ROUTER_MAX_AGE_TO_PUBLISH;
|
||||||
char *answer;
|
char *answer;
|
||||||
routerlist_t *rl = router_get_routerlist();
|
routerlist_t *rl = router_get_routerlist();
|
||||||
smartlist_t *statuses;
|
smartlist_t *statuses;
|
||||||
uint8_t purpose = router_purpose_from_string(purpose_string);
|
const uint8_t purpose = router_purpose_from_string(purpose_string);
|
||||||
routerstatus_t rs;
|
routerstatus_t rs;
|
||||||
int bridge_auth = authdir_mode_bridge(get_options());
|
const int bridge_auth = authdir_mode_bridge(get_options());
|
||||||
|
|
||||||
if (purpose == ROUTER_PURPOSE_UNKNOWN) {
|
if (purpose == ROUTER_PURPOSE_UNKNOWN) {
|
||||||
log_info(LD_DIR, "Unrecognized purpose '%s' when listing router statuses.",
|
log_info(LD_DIR, "Unrecognized purpose '%s' when listing router statuses.",
|
||||||
@ -2247,6 +2247,7 @@ networkstatus_getinfo_by_purpose(const char *purpose_string, time_t now)
|
|||||||
continue;
|
continue;
|
||||||
if (ri->purpose != purpose)
|
if (ri->purpose != purpose)
|
||||||
continue;
|
continue;
|
||||||
|
/* TODO: modifying the running flag in a getinfo is a bad idea */
|
||||||
if (bridge_auth && ri->purpose == ROUTER_PURPOSE_BRIDGE)
|
if (bridge_auth && ri->purpose == ROUTER_PURPOSE_BRIDGE)
|
||||||
dirserv_set_router_is_running(ri, now);
|
dirserv_set_router_is_running(ri, now);
|
||||||
/* then generate and write out status lines for each of them */
|
/* then generate and write out status lines for each of them */
|
||||||
|
Loading…
Reference in New Issue
Block a user