[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]
[or-cvs] r10112: early skeletal support for running a bridge directory author (tor/trunk/src/or)
- To: or-cvs@xxxxxxxxxxxxx
- Subject: [or-cvs] r10112: early skeletal support for running a bridge directory author (tor/trunk/src/or)
- From: arma@xxxxxxxx
- Date: Fri, 4 May 2007 04:04:38 -0400 (EDT)
- Delivered-to: archiver@seul.org
- Delivered-to: or-cvs-outgoing@seul.org
- Delivered-to: or-cvs@seul.org
- Delivery-date: Fri, 04 May 2007 04:04:59 -0400
- Reply-to: or-dev@xxxxxxxxxxxxx
- Sender: owner-or-cvs@xxxxxxxxxxxxx
Author: arma
Date: 2007-05-04 04:04:27 -0400 (Fri, 04 May 2007)
New Revision: 10112
Modified:
tor/trunk/src/or/config.c
tor/trunk/src/or/directory.c
tor/trunk/src/or/dirserv.c
tor/trunk/src/or/or.h
tor/trunk/src/or/router.c
Log:
early skeletal support for running a bridge directory authority
Modified: tor/trunk/src/or/config.c
===================================================================
--- tor/trunk/src/or/config.c 2007-05-04 07:24:01 UTC (rev 10111)
+++ tor/trunk/src/or/config.c 2007-05-04 08:04:27 UTC (rev 10112)
@@ -136,6 +136,7 @@
VAR("AvoidDiskWrites", BOOL, AvoidDiskWrites, "0"),
VAR("BandwidthBurst", MEMUNIT, BandwidthBurst, "6 MB"),
VAR("BandwidthRate", MEMUNIT, BandwidthRate, "3 MB"),
+ VAR("BridgeAuthoritativeDir", BOOL, BridgeAuthoritativeDir, "0"),
VAR("CircuitBuildTimeout", INTERVAL, CircuitBuildTimeout, "1 minute"),
VAR("CircuitIdleTimeout", INTERVAL, CircuitIdleTimeout, "1 hour"),
VAR("ClientOnly", BOOL, ClientOnly, "0"),
Modified: tor/trunk/src/or/directory.c
===================================================================
--- tor/trunk/src/or/directory.c 2007-05-04 07:24:01 UTC (rev 10111)
+++ tor/trunk/src/or/directory.c 2007-05-04 08:04:27 UTC (rev 10112)
@@ -1831,7 +1831,8 @@
if (!strcmp(url,"/tor/dir-all-weaselhack") &&
(conn->_base.addr == 0x7f000001ul) &&
- authdir_mode_v2(options)) {
+ authdir_mode_v2(options) &&
+ !authdir_mode_bridge(options)) {
/* until weasel rewrites his scripts at noreply */
char *new_directory=NULL;
Modified: tor/trunk/src/or/dirserv.c
===================================================================
--- tor/trunk/src/or/dirserv.c 2007-05-04 07:24:01 UTC (rev 10111)
+++ tor/trunk/src/or/dirserv.c 2007-05-04 08:04:27 UTC (rev 10112)
@@ -1226,23 +1226,23 @@
}
}
-/** Helper: If we're an authority for the right directory version (v1 if
- * <b>is_v1_object</b> if non-0, else v2), try to regenerate
+/** Helper: If we're an authority for the right directory version
+ * (based on <b>auth_type</b>), try to regenerate
* auth_src as appropriate and return it, falling back to cache_src on
- * failure. If we're a cache, return cache_src.
+ * failure. If we're a cache, simply return cache_src.
*/
static cached_dir_t *
dirserv_pick_cached_dir_obj(cached_dir_t *cache_src,
cached_dir_t *auth_src,
time_t dirty, cached_dir_t *(*regenerate)(void),
const char *name,
- int is_v1_object)
+ authority_type_t auth_type)
{
or_options_t *options = get_options();
- int authority = (authdir_mode_v1(options) && is_v1_object) ||
- (authdir_mode_v2(options) && !is_v1_object);
+ int authority = (auth_type == V1_AUTHORITY && authdir_mode_v1(options)) ||
+ (auth_type == V2_AUTHORITY && authdir_mode_v2(options));
- if (!authority) {
+ if (!authority || authdir_mode_bridge(options)) { /* XXX020 */
return cache_src;
} else {
/* We're authoritative. */
@@ -1268,7 +1268,7 @@
* set; otherwise return the uncompressed version. (In either case, sets
* *<b>out</b> and returns the size of the buffer in *<b>out</b>.)
*
- * Use <b>is_v1_object</b> to help determine whether we're authoritative for
+ * Use <b>auth_type</b> to help determine whether we're authoritative for
* this kind of object.
**/
static size_t
@@ -1278,11 +1278,11 @@
cached_dir_t *auth_src,
time_t dirty, cached_dir_t *(*regenerate)(void),
const char *name,
- int is_v1_object)
+ authority_type_t auth_type)
{
cached_dir_t *d = dirserv_pick_cached_dir_obj(
cache_src, auth_src,
- dirty, regenerate, name, is_v1_object);
+ dirty, regenerate, name, auth_type);
if (!d)
return 0;
@@ -1304,7 +1304,7 @@
return dirserv_pick_cached_dir_obj(cached_directory, the_directory,
the_directory_is_dirty,
dirserv_regenerate_directory,
- "server directory", 1);
+ "server directory", V1_AUTHORITY);
}
/** Only called by v1 auth dirservers.
@@ -1406,7 +1406,7 @@
&cached_runningrouters, &the_runningrouters,
runningrouters_is_dirty,
generate_runningrouters,
- "v1 network status list", 1);
+ "v1 network status list", V1_AUTHORITY);
}
/** For authoritative directories: the current (v2) network status. */
@@ -1418,6 +1418,7 @@
should_generate_v2_networkstatus(void)
{
return authdir_mode_v2(get_options()) &&
+ !authdir_mode_bridge(get_options()) && /* XXX020 */
the_v2_networkstatus_is_dirty &&
the_v2_networkstatus_is_dirty + DIR_REGEN_SLACK_TIME < time(NULL);
}
Modified: tor/trunk/src/or/or.h
===================================================================
--- tor/trunk/src/or/or.h 2007-05-04 07:24:01 UTC (rev 10111)
+++ tor/trunk/src/or/or.h 2007-05-04 08:04:27 UTC (rev 10112)
@@ -1735,6 +1735,8 @@
int VersioningAuthoritativeDir; /**< Boolean: is this an authoritative
* directory that's willing to recommend
* versions? */
+ int BridgeAuthoritativeDir; /**< Boolean: is this an authoritative directory
+ * that aggregates bridge descriptors? */
int AvoidDiskWrites; /**< Boolean: should we never cache things to disk?
* Not used yet. */
int ClientOnly; /**< Boolean: should we never evolve into a server role? */
@@ -2951,6 +2953,7 @@
int authdir_mode_v1(or_options_t *options);
int authdir_mode_v2(or_options_t *options);
int authdir_mode_handles_descs(or_options_t *options);
+int authdir_mode_bridge(or_options_t *options);
int clique_mode(or_options_t *options);
int server_mode(or_options_t *options);
int advertised_server_mode(void);
@@ -3031,7 +3034,7 @@
int for_v2_directory,
int retry_if_no_servers);
typedef enum {
- V1_AUTHORITY, V2_AUTHORITY, HIDSERV_AUTHORITY,
+ V1_AUTHORITY, V2_AUTHORITY, HIDSERV_AUTHORITY, BRIDGE_AUTHORITY
} authority_type_t;
routerstatus_t *router_pick_trusteddirserver(authority_type_t type,
int requireother,
Modified: tor/trunk/src/or/router.c
===================================================================
--- tor/trunk/src/or/router.c 2007-05-04 07:24:01 UTC (rev 10111)
+++ tor/trunk/src/or/router.c 2007-05-04 08:04:27 UTC (rev 10112)
@@ -619,6 +619,14 @@
{
return authdir_mode_v1(options) || authdir_mode_v2(options);
}
+/** Return true iff we believe ourselves to be a bridge authoritative
+ * directory server.
+ */
+int
+authdir_mode_bridge(or_options_t *options)
+{
+ return authdir_mode(options) && options->BridgeAuthoritativeDir != 0;
+}
/** Return true iff we try to stay connected to all ORs at once.
*/
int