[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]

[or-cvs] r17652: {tor} Rename a couple of v2-networkstatus-only fields so that it i (tor/trunk/src/or)



Author: nickm
Date: 2008-12-17 12:20:48 -0500 (Wed, 17 Dec 2008)
New Revision: 17652

Modified:
   tor/trunk/src/or/directory.c
   tor/trunk/src/or/networkstatus.c
   tor/trunk/src/or/or.h
Log:
Rename a couple of v2-networkstatus-only fields so that it is clear they are v2-networkstatus-only.

Modified: tor/trunk/src/or/directory.c
===================================================================
--- tor/trunk/src/or/directory.c	2008-12-17 17:20:42 UTC (rev 17651)
+++ tor/trunk/src/or/directory.c	2008-12-17 17:20:48 UTC (rev 17652)
@@ -108,7 +108,7 @@
   if (dir_purpose == DIR_PURPOSE_UPLOAD_DIR ||
       dir_purpose == DIR_PURPOSE_UPLOAD_VOTE ||
       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_DETACHED_SIGNATURES ||
       dir_purpose == DIR_PURPOSE_FETCH_CONSENSUS ||
@@ -158,7 +158,7 @@
       return "server vote upload";
     case DIR_PURPOSE_UPLOAD_SIGNATURES:
       return "consensus signature upload";
-    case DIR_PURPOSE_FETCH_NETWORKSTATUS:
+    case DIR_PURPOSE_FETCH_V2_NETWORKSTATUS:
       return "network-status fetch";
     case DIR_PURPOSE_FETCH_SERVERDESC:
       return "server descriptor fetch";
@@ -312,7 +312,7 @@
              (router_purpose == ROUTER_PURPOSE_BRIDGE ? BRIDGE_AUTHORITY :
                                                         V2_AUTHORITY);
       break;
-    case DIR_PURPOSE_FETCH_NETWORKSTATUS:
+    case DIR_PURPOSE_FETCH_V2_NETWORKSTATUS:
     case DIR_PURPOSE_FETCH_SERVERDESC:
       type = (router_purpose == ROUTER_PURPOSE_BRIDGE ? BRIDGE_AUTHORITY :
                                                         V2_AUTHORITY);
@@ -564,7 +564,7 @@
   }
   if (entry_list_can_grow(get_options()))
     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",
              conn->_base.address);
     connection_dir_download_networkstatus_failed(conn, -1);
@@ -980,7 +980,7 @@
   }
 
   switch (purpose) {
-    case DIR_PURPOSE_FETCH_NETWORKSTATUS:
+    case DIR_PURPOSE_FETCH_V2_NETWORKSTATUS:
       tor_assert(resource);
       httpcommand = "GET";
       len = strlen(resource)+32;
@@ -1555,9 +1555,9 @@
     }
   }
 
-  if (conn->_base.purpose == DIR_PURPOSE_FETCH_NETWORKSTATUS) {
+  if (conn->_base.purpose == DIR_PURPOSE_FETCH_V2_NETWORKSTATUS) {
     smartlist_t *which = NULL;
-    networkstatus_source_t source;
+    v2_networkstatus_source_t source;
     char *cp;
     log_info(LD_DIR,"Received networkstatus objects (size %d) from server "
              "'%s:%d'",(int) body_len, conn->_base.address, conn->_base.port);
@@ -2194,7 +2194,7 @@
   char *key;
   const char *kind = NULL;
   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_CERTIFICATE:   kind = "dl/cert"; break;
     case DIR_PURPOSE_FETCH_STATUS_VOTE:   kind = "dl/vote"; break;

Modified: tor/trunk/src/or/networkstatus.c
===================================================================
--- tor/trunk/src/or/networkstatus.c	2008-12-17 17:20:42 UTC (rev 17651)
+++ tor/trunk/src/or/networkstatus.c	2008-12-17 17:20:48 UTC (rev 17652)
@@ -510,7 +510,7 @@
  * appropriate. */
 static int
 add_networkstatus_to_cache(const char *s,
-                           networkstatus_source_t source,
+                           v2_networkstatus_source_t source,
                            networkstatus_v2_t *ns)
 {
   if (source != NS_FROM_CACHE) {
@@ -555,7 +555,8 @@
  */
 int
 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;
   int i, found;
@@ -1021,7 +1022,7 @@
          /* Is this quite sensible with IPv6 or multiple addresses? */
          if (connection_get_by_type_addr_port_purpose(
                 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
             * doing a tunneled conn. In that case it should be or_port.
             * How to guess from here? Maybe make the function less general
@@ -1035,7 +1036,7 @@
          base16_encode(resource+3, sizeof(resource)-3, ds->digest, DIGEST_LEN);
          strlcat(resource, ".z", sizeof(resource));
          directory_initiate_command_routerstatus(
-               &ds->fake_status, DIR_PURPOSE_FETCH_NETWORKSTATUS,
+               &ds->fake_status, DIR_PURPOSE_FETCH_V2_NETWORKSTATUS,
                ROUTER_PURPOSE_GENERAL,
                0, /* Not private */
                resource,
@@ -1047,8 +1048,8 @@
     /* A non-authority cache launches one connection to a random authority. */
     /* (Check whether we're currently fetching network-status objects.) */
     if (!connection_get_by_type_purpose(CONN_TYPE_DIR,
-                                        DIR_PURPOSE_FETCH_NETWORKSTATUS))
-      directory_get_from_dirserver(DIR_PURPOSE_FETCH_NETWORKSTATUS,
+                                        DIR_PURPOSE_FETCH_V2_NETWORKSTATUS))
+      directory_get_from_dirserver(DIR_PURPOSE_FETCH_V2_NETWORKSTATUS,
                                    ROUTER_PURPOSE_GENERAL, "all.z",
                                    PDS_RETRY_IF_NO_SERVERS);
   }

Modified: tor/trunk/src/or/or.h
===================================================================
--- tor/trunk/src/or/or.h	2008-12-17 17:20:42 UTC (rev 17651)
+++ tor/trunk/src/or/or.h	2008-12-17 17:20:48 UTC (rev 17652)
@@ -339,7 +339,7 @@
 #define DIR_PURPOSE_HAS_FETCHED_RENDDESC 4
 /** A connection to a directory server: download one or more v2
  * 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
  * descriptors. */
 #define DIR_PURPOSE_FETCH_SERVERDESC 6
@@ -3679,7 +3679,7 @@
 /** Location where we found a v2 networkstatus. */
 typedef enum {
   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
  * servers. */
@@ -3712,7 +3712,7 @@
                                         authority_cert_t *cert);
 char *networkstatus_get_cache_filename(const char *identity_digest);
 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);
 void networkstatus_v2_list_clean(time_t now);
 routerstatus_t *networkstatus_v2_find_entry(networkstatus_v2_t *ns,