소스 검색

Have dirctory authorites note which servers make good V2 directory caches in publishe network-status.

svn:r5574
Nick Mathewson 20 년 전
부모
커밋
27a201ac80
3개의 변경된 파일10개의 추가작업 그리고 2개의 파일을 삭제
  1. 5 2
      src/or/dirserv.c
  2. 3 0
      src/or/or.h
  3. 2 0
      src/or/routerparse.c

+ 5 - 2
src/or/dirserv.c

@@ -1299,6 +1299,8 @@ generate_v2_networkstatus(void)
                                       ri->cache_info.identity_digest);
       int f_named = naming && ri->is_named;
       int f_valid = ri->is_verified;
+      int f_v2_dir = ri->dir_port &&
+        tor_version_as_new_as(ri->platform,"0.1.1.9-alpha");
       char identity64[BASE64_DIGEST_LEN+1];
       char digest64[BASE64_DIGEST_LEN+1];
       if (options->AuthoritativeDir) {
@@ -1316,7 +1318,7 @@ generate_v2_networkstatus(void)
 
       if (tor_snprintf(outp, endp-outp,
                        "r %s %s %s %s %s %d %d\n"
-                       "s%s%s%s%s%s%s%s\n",
+                       "s%s%s%s%s%s%s%s%s\n",
                        ri->nickname,
                        identity64,
                        digest64,
@@ -1330,7 +1332,8 @@ generate_v2_networkstatus(void)
                        f_named?" Named":"",
                        f_stable?" Stable":"",
                        f_running?" Running":"",
-                       f_valid?" Valid":"")<0) {
+                       f_valid?" Valid":"",
+                       f_v2_dir?" V2Dir":"")<0) {
         warn(LD_BUG, "Unable to print router status.");
         goto done;
       }

+ 3 - 0
src/or/or.h

@@ -827,6 +827,9 @@ typedef struct routerstatus_t {
   unsigned int is_running:1; /**< True iff this router is up. */
   unsigned int is_named:1; /**< True iff "nickname" belongs to this router. */
   unsigned int is_valid:1; /**< True iff this router is validated. */
+  unsigned int is_v2_dir:1; /**< True iff this router can serve router
+                             * information with v2 of the directory
+                             * protocol */
 } routerstatus_t;
 
 /** DOCDOC */

+ 2 - 0
src/or/routerparse.c

@@ -1057,6 +1057,8 @@ routerstatus_parse_entry_from_string(const char **s, smartlist_t *tokens)
         rs->is_named = 1;
       else if (!strcmp(tok->args[i], "Valid"))
         rs->is_valid = 1;
+      else if (!strcmp(tok->args[i], "V2Dir"))
+        rs->is_v2_dir = 1;
     }
   }