[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]
[or-cvs] Make dirservers generate a separate "guard" flag to mean, "...
Update of /home/or/cvsroot/tor/src/or
In directory moria:/tmp/cvs-serv14753/src/or
Modified Files:
dirserv.c or.h routerlist.c routerparse.c
Log Message:
Make dirservers generate a separate "guard" flag to mean, "would make a good entry guard". Make clients parse it and vote on it.
Index: dirserv.c
===================================================================
RCS file: /home/or/cvsroot/tor/src/or/dirserv.c,v
retrieving revision 1.292
retrieving revision 1.293
diff -u -p -d -r1.292 -r1.293
--- dirserv.c 12 Jan 2006 18:04:17 -0000 1.292
+++ dirserv.c 24 Jan 2006 00:31:15 -0000 1.293
@@ -1422,6 +1422,7 @@ generate_v2_networkstatus(void)
ri->cache_info.identity_digest);
int f_named = naming && ri->is_named;
int f_valid = ri->is_verified;
+ int f_guard = f_fast && f_stable;
/* 0.1.1.9-alpha is the first version to support fetch by descriptor
* hash. */
int f_v2_dir = ri->dir_port &&
@@ -1450,6 +1451,7 @@ generate_v2_networkstatus(void)
f_authority?" Authority":"",
f_exit?" Exit":"",
f_fast?" Fast":"",
+ f_guard?" Guard":"",
f_named?" Named":"",
f_stable?" Stable":"",
f_running?" Running":"",
Index: or.h
===================================================================
RCS file: /home/or/cvsroot/tor/src/or/or.h,v
retrieving revision 1.782
retrieving revision 1.783
diff -u -p -d -r1.782 -r1.783
--- or.h 20 Jan 2006 20:54:42 -0000 1.782
+++ or.h 24 Jan 2006 00:31:16 -0000 1.783
@@ -844,6 +844,8 @@ typedef struct routerstatus_t {
* information with v2 of the directory
* protocol. (All directory caches cache v1
* directories.) */
+ unsigned int is_possible_guard:1; /**< True iff this router would be a good
+ * choice as an entry guard. */
/** True if we, as a directory mirror, want to download the corresponding
* routerinfo from the authority who gave us this routerstatus. (That is,
Index: routerlist.c
===================================================================
RCS file: /home/or/cvsroot/tor/src/or/routerlist.c,v
retrieving revision 1.428
retrieving revision 1.429
diff -u -p -d -r1.428 -r1.429
--- routerlist.c 20 Jan 2006 20:54:42 -0000 1.428
+++ routerlist.c 24 Jan 2006 00:31:16 -0000 1.429
@@ -2941,7 +2941,7 @@ routerstatus_list_update_from_networksta
*/
while (1) {
int n_running=0, n_named=0, n_valid=0, n_listing=0;
- int n_v2_dir=0, n_fast=0, n_stable=0, n_exit=0;
+ int n_v2_dir=0, n_fast=0, n_stable=0, n_exit=0, n_guard=0;
int n_desc_digests=0, highest_count=0;
const char *the_name = NULL;
local_routerstatus_t *rs_out, *rs_old;
@@ -3020,6 +3020,8 @@ routerstatus_list_update_from_networksta
++n_exit;
if (rs->is_fast)
++n_fast;
+ if (rs->is_possible_guard)
+ ++n_guard;
if (rs->is_stable)
++n_stable;
if (rs->is_v2_dir)
@@ -3069,6 +3071,7 @@ routerstatus_list_update_from_networksta
rs_out->status.is_running = n_running > n_recent/2;
rs_out->status.is_exit = n_exit > n_statuses/2;
rs_out->status.is_fast = n_fast > n_statuses/2;
+ rs_out->status.is_fast = n_guard > n_statuses/2;
rs_out->status.is_stable = n_stable > n_statuses/2;
rs_out->status.is_v2_dir = n_v2_dir > n_statuses/2;
}
Index: routerparse.c
===================================================================
RCS file: /home/or/cvsroot/tor/src/or/routerparse.c,v
retrieving revision 1.169
retrieving revision 1.170
diff -u -p -d -r1.169 -r1.170
--- routerparse.c 20 Jan 2006 20:54:42 -0000 1.169
+++ routerparse.c 24 Jan 2006 00:31:16 -0000 1.170
@@ -1037,6 +1037,8 @@ routerstatus_parse_entry_from_string(con
rs->is_valid = 1;
else if (!strcmp(tok->args[i], "V2Dir"))
rs->is_v2_dir = 1;
+ else if (!strcmp(tok->args[i], "Guard"))
+ rs->is_possible_guard = 1;
}
}