mirror of
https://gitlab.torproject.org/tpo/core/tor.git
synced 2024-11-28 14:23:30 +01:00
Clean up should-i-go-to-the-dirserv logic a little: All servers with DirPorts should get their directories from the source
svn:r4930
This commit is contained in:
parent
3a99927859
commit
ff9452e900
@ -113,7 +113,9 @@ purpose_is_private(uint8_t purpose)
|
|||||||
{
|
{
|
||||||
if (purpose == DIR_PURPOSE_FETCH_DIR ||
|
if (purpose == DIR_PURPOSE_FETCH_DIR ||
|
||||||
purpose == DIR_PURPOSE_UPLOAD_DIR ||
|
purpose == DIR_PURPOSE_UPLOAD_DIR ||
|
||||||
purpose == DIR_PURPOSE_FETCH_RUNNING_LIST)
|
purpose == DIR_PURPOSE_FETCH_RUNNING_LIST ||
|
||||||
|
purpose == DIR_PURPOSE_FETCH_NETWORKSTATUS ||
|
||||||
|
purpose == DIR_PURPOSE_FETCH_SERVERDESC)
|
||||||
return 0;
|
return 0;
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
@ -162,12 +164,10 @@ directory_get_from_dirserver(uint8_t purpose, const char *resource,
|
|||||||
routerinfo_t *r = NULL;
|
routerinfo_t *r = NULL;
|
||||||
trusted_dir_server_t *ds = NULL;
|
trusted_dir_server_t *ds = NULL;
|
||||||
int fascistfirewall = firewall_is_fascist();
|
int fascistfirewall = firewall_is_fascist();
|
||||||
int directconn = purpose == DIR_PURPOSE_FETCH_DIR ||
|
or_options_t *options = get_options();
|
||||||
purpose == DIR_PURPOSE_FETCH_RUNNING_LIST ||
|
int fetch_fresh_first = server_mode(options) && options->DirPort != 0;
|
||||||
purpose == DIR_PURPOSE_FETCH_NETWORKSTATUS ||
|
int directconn = !purpose_is_private(purpose);
|
||||||
purpose == DIR_PURPOSE_FETCH_SERVERDESC;
|
|
||||||
int fetch_fresh_first = advertised_server_mode();
|
|
||||||
int priv = purpose_is_private(purpose);
|
|
||||||
int need_v1_support = purpose == DIR_PURPOSE_FETCH_DIR ||
|
int need_v1_support = purpose == DIR_PURPOSE_FETCH_DIR ||
|
||||||
purpose == DIR_PURPOSE_FETCH_RUNNING_LIST;
|
purpose == DIR_PURPOSE_FETCH_RUNNING_LIST;
|
||||||
int need_v2_support = purpose == DIR_PURPOSE_FETCH_NETWORKSTATUS ||
|
int need_v2_support = purpose == DIR_PURPOSE_FETCH_NETWORKSTATUS ||
|
||||||
@ -213,9 +213,9 @@ directory_get_from_dirserver(uint8_t purpose, const char *resource,
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (r)
|
if (r)
|
||||||
directory_initiate_command_router(r, purpose, priv, resource, NULL, 0);
|
directory_initiate_command_router(r, purpose, !directconn, resource, NULL, 0);
|
||||||
else if (ds)
|
else if (ds)
|
||||||
directory_initiate_command_trusted_dir(ds, purpose, priv, resource, NULL, 0);
|
directory_initiate_command_trusted_dir(ds, purpose, !directconn, resource, NULL, 0);
|
||||||
else {
|
else {
|
||||||
log_fn(LOG_NOTICE,"No running dirservers known. Will try again later. (purpose %d)",
|
log_fn(LOG_NOTICE,"No running dirservers known. Will try again later. (purpose %d)",
|
||||||
purpose);
|
purpose);
|
||||||
|
Loading…
Reference in New Issue
Block a user