Rename a couple of v2-networkstatus-only fields so that it is clear they are v2-networkstatus-only.

svn:r17652
This commit is contained in:
Nick Mathewson 2008-12-17 17:20:48 +00:00
parent f43bcdc063
commit 2de9bd7bae
3 changed files with 18 additions and 17 deletions

View File

@ -108,7 +108,7 @@ purpose_needs_anonymity(uint8_t dir_purpose, uint8_t router_purpose)
if (dir_purpose == DIR_PURPOSE_UPLOAD_DIR || if (dir_purpose == DIR_PURPOSE_UPLOAD_DIR ||
dir_purpose == DIR_PURPOSE_UPLOAD_VOTE || dir_purpose == DIR_PURPOSE_UPLOAD_VOTE ||
dir_purpose == DIR_PURPOSE_UPLOAD_SIGNATURES || dir_purpose == DIR_PURPOSE_UPLOAD_SIGNATURES ||
dir_purpose == DIR_PURPOSE_FETCH_NETWORKSTATUS || dir_purpose == DIR_PURPOSE_FETCH_V2_NETWORKSTATUS ||
dir_purpose == DIR_PURPOSE_FETCH_STATUS_VOTE || dir_purpose == DIR_PURPOSE_FETCH_STATUS_VOTE ||
dir_purpose == DIR_PURPOSE_FETCH_DETACHED_SIGNATURES || dir_purpose == DIR_PURPOSE_FETCH_DETACHED_SIGNATURES ||
dir_purpose == DIR_PURPOSE_FETCH_CONSENSUS || dir_purpose == DIR_PURPOSE_FETCH_CONSENSUS ||
@ -158,7 +158,7 @@ dir_conn_purpose_to_string(int purpose)
return "server vote upload"; return "server vote upload";
case DIR_PURPOSE_UPLOAD_SIGNATURES: case DIR_PURPOSE_UPLOAD_SIGNATURES:
return "consensus signature upload"; return "consensus signature upload";
case DIR_PURPOSE_FETCH_NETWORKSTATUS: case DIR_PURPOSE_FETCH_V2_NETWORKSTATUS:
return "network-status fetch"; return "network-status fetch";
case DIR_PURPOSE_FETCH_SERVERDESC: case DIR_PURPOSE_FETCH_SERVERDESC:
return "server descriptor fetch"; return "server descriptor fetch";
@ -312,7 +312,7 @@ directory_get_from_dirserver(uint8_t dir_purpose, uint8_t router_purpose,
(router_purpose == ROUTER_PURPOSE_BRIDGE ? BRIDGE_AUTHORITY : (router_purpose == ROUTER_PURPOSE_BRIDGE ? BRIDGE_AUTHORITY :
V2_AUTHORITY); V2_AUTHORITY);
break; break;
case DIR_PURPOSE_FETCH_NETWORKSTATUS: case DIR_PURPOSE_FETCH_V2_NETWORKSTATUS:
case DIR_PURPOSE_FETCH_SERVERDESC: case DIR_PURPOSE_FETCH_SERVERDESC:
type = (router_purpose == ROUTER_PURPOSE_BRIDGE ? BRIDGE_AUTHORITY : type = (router_purpose == ROUTER_PURPOSE_BRIDGE ? BRIDGE_AUTHORITY :
V2_AUTHORITY); V2_AUTHORITY);
@ -564,7 +564,7 @@ connection_dir_request_failed(dir_connection_t *conn)
} }
if (entry_list_can_grow(get_options())) if (entry_list_can_grow(get_options()))
router_set_status(conn->identity_digest, 0); /* don't try him again */ router_set_status(conn->identity_digest, 0); /* don't try him again */
if (conn->_base.purpose == DIR_PURPOSE_FETCH_NETWORKSTATUS) { if (conn->_base.purpose == DIR_PURPOSE_FETCH_V2_NETWORKSTATUS) {
log_info(LD_DIR, "Giving up on directory server at '%s'; retrying", log_info(LD_DIR, "Giving up on directory server at '%s'; retrying",
conn->_base.address); conn->_base.address);
connection_dir_download_networkstatus_failed(conn, -1); connection_dir_download_networkstatus_failed(conn, -1);
@ -980,7 +980,7 @@ directory_send_command(dir_connection_t *conn,
} }
switch (purpose) { switch (purpose) {
case DIR_PURPOSE_FETCH_NETWORKSTATUS: case DIR_PURPOSE_FETCH_V2_NETWORKSTATUS:
tor_assert(resource); tor_assert(resource);
httpcommand = "GET"; httpcommand = "GET";
len = strlen(resource)+32; len = strlen(resource)+32;
@ -1555,9 +1555,9 @@ connection_dir_client_reached_eof(dir_connection_t *conn)
} }
} }
if (conn->_base.purpose == DIR_PURPOSE_FETCH_NETWORKSTATUS) { if (conn->_base.purpose == DIR_PURPOSE_FETCH_V2_NETWORKSTATUS) {
smartlist_t *which = NULL; smartlist_t *which = NULL;
networkstatus_source_t source; v2_networkstatus_source_t source;
char *cp; char *cp;
log_info(LD_DIR,"Received networkstatus objects (size %d) from server " log_info(LD_DIR,"Received networkstatus objects (size %d) from server "
"'%s:%d'",(int) body_len, conn->_base.address, conn->_base.port); "'%s:%d'",(int) body_len, conn->_base.address, conn->_base.port);
@ -2194,7 +2194,7 @@ note_client_request(int purpose, int compressed, size_t bytes)
char *key; char *key;
const char *kind = NULL; const char *kind = NULL;
switch (purpose) { switch (purpose) {
case DIR_PURPOSE_FETCH_NETWORKSTATUS: kind = "dl/status"; break; case DIR_PURPOSE_FETCH_V2_NETWORKSTATUS: kind = "dl/status"; break;
case DIR_PURPOSE_FETCH_CONSENSUS: kind = "dl/consensus"; break; case DIR_PURPOSE_FETCH_CONSENSUS: kind = "dl/consensus"; break;
case DIR_PURPOSE_FETCH_CERTIFICATE: kind = "dl/cert"; break; case DIR_PURPOSE_FETCH_CERTIFICATE: kind = "dl/cert"; break;
case DIR_PURPOSE_FETCH_STATUS_VOTE: kind = "dl/vote"; break; case DIR_PURPOSE_FETCH_STATUS_VOTE: kind = "dl/vote"; break;

View File

@ -510,7 +510,7 @@ _compare_networkstatus_v2_published_on(const void **_a, const void **_b)
* appropriate. */ * appropriate. */
static int static int
add_networkstatus_to_cache(const char *s, add_networkstatus_to_cache(const char *s,
networkstatus_source_t source, v2_networkstatus_source_t source,
networkstatus_v2_t *ns) networkstatus_v2_t *ns)
{ {
if (source != NS_FROM_CACHE) { if (source != NS_FROM_CACHE) {
@ -555,7 +555,8 @@ add_networkstatus_to_cache(const char *s,
*/ */
int int
router_set_networkstatus_v2(const char *s, time_t arrived_at, router_set_networkstatus_v2(const char *s, time_t arrived_at,
networkstatus_source_t source, smartlist_t *requested_fingerprints) v2_networkstatus_source_t source,
smartlist_t *requested_fingerprints)
{ {
networkstatus_v2_t *ns; networkstatus_v2_t *ns;
int i, found; int i, found;
@ -1021,7 +1022,7 @@ update_v2_networkstatus_cache_downloads(time_t now)
/* Is this quite sensible with IPv6 or multiple addresses? */ /* Is this quite sensible with IPv6 or multiple addresses? */
if (connection_get_by_type_addr_port_purpose( if (connection_get_by_type_addr_port_purpose(
CONN_TYPE_DIR, &addr, ds->dir_port, CONN_TYPE_DIR, &addr, ds->dir_port,
DIR_PURPOSE_FETCH_NETWORKSTATUS)) { DIR_PURPOSE_FETCH_V2_NETWORKSTATUS)) {
/* XXX020 the above dir_port won't be accurate if we're /* XXX020 the above dir_port won't be accurate if we're
* doing a tunneled conn. In that case it should be or_port. * doing a tunneled conn. In that case it should be or_port.
* How to guess from here? Maybe make the function less general * How to guess from here? Maybe make the function less general
@ -1035,7 +1036,7 @@ update_v2_networkstatus_cache_downloads(time_t now)
base16_encode(resource+3, sizeof(resource)-3, ds->digest, DIGEST_LEN); base16_encode(resource+3, sizeof(resource)-3, ds->digest, DIGEST_LEN);
strlcat(resource, ".z", sizeof(resource)); strlcat(resource, ".z", sizeof(resource));
directory_initiate_command_routerstatus( directory_initiate_command_routerstatus(
&ds->fake_status, DIR_PURPOSE_FETCH_NETWORKSTATUS, &ds->fake_status, DIR_PURPOSE_FETCH_V2_NETWORKSTATUS,
ROUTER_PURPOSE_GENERAL, ROUTER_PURPOSE_GENERAL,
0, /* Not private */ 0, /* Not private */
resource, resource,
@ -1047,8 +1048,8 @@ update_v2_networkstatus_cache_downloads(time_t now)
/* A non-authority cache launches one connection to a random authority. */ /* A non-authority cache launches one connection to a random authority. */
/* (Check whether we're currently fetching network-status objects.) */ /* (Check whether we're currently fetching network-status objects.) */
if (!connection_get_by_type_purpose(CONN_TYPE_DIR, if (!connection_get_by_type_purpose(CONN_TYPE_DIR,
DIR_PURPOSE_FETCH_NETWORKSTATUS)) DIR_PURPOSE_FETCH_V2_NETWORKSTATUS))
directory_get_from_dirserver(DIR_PURPOSE_FETCH_NETWORKSTATUS, directory_get_from_dirserver(DIR_PURPOSE_FETCH_V2_NETWORKSTATUS,
ROUTER_PURPOSE_GENERAL, "all.z", ROUTER_PURPOSE_GENERAL, "all.z",
PDS_RETRY_IF_NO_SERVERS); PDS_RETRY_IF_NO_SERVERS);
} }

View File

@ -339,7 +339,7 @@ typedef enum {
#define DIR_PURPOSE_HAS_FETCHED_RENDDESC 4 #define DIR_PURPOSE_HAS_FETCHED_RENDDESC 4
/** A connection to a directory server: download one or more v2 /** A connection to a directory server: download one or more v2
* network-status objects */ * network-status objects */
#define DIR_PURPOSE_FETCH_NETWORKSTATUS 5 #define DIR_PURPOSE_FETCH_V2_NETWORKSTATUS 5
/** A connection to a directory server: download one or more server /** A connection to a directory server: download one or more server
* descriptors. */ * descriptors. */
#define DIR_PURPOSE_FETCH_SERVERDESC 6 #define DIR_PURPOSE_FETCH_SERVERDESC 6
@ -3679,7 +3679,7 @@ int tor_init(int argc, char **argv);
/** Location where we found a v2 networkstatus. */ /** Location where we found a v2 networkstatus. */
typedef enum { typedef enum {
NS_FROM_CACHE, NS_FROM_DIR_BY_FP, NS_FROM_DIR_ALL, NS_GENERATED NS_FROM_CACHE, NS_FROM_DIR_BY_FP, NS_FROM_DIR_ALL, NS_GENERATED
} networkstatus_source_t; } v2_networkstatus_source_t;
/** Possible statuses of a version of Tor, given opinions from the directory /** Possible statuses of a version of Tor, given opinions from the directory
* servers. */ * servers. */
@ -3712,7 +3712,7 @@ int networkstatus_check_voter_signature(networkstatus_t *consensus,
authority_cert_t *cert); authority_cert_t *cert);
char *networkstatus_get_cache_filename(const char *identity_digest); char *networkstatus_get_cache_filename(const char *identity_digest);
int router_set_networkstatus_v2(const char *s, time_t arrived_at, int router_set_networkstatus_v2(const char *s, time_t arrived_at,
networkstatus_source_t source, v2_networkstatus_source_t source,
smartlist_t *requested_fingerprints); smartlist_t *requested_fingerprints);
void networkstatus_v2_list_clean(time_t now); void networkstatus_v2_list_clean(time_t now);
routerstatus_t *networkstatus_v2_find_entry(networkstatus_v2_t *ns, routerstatus_t *networkstatus_v2_find_entry(networkstatus_v2_t *ns,