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"),
}
}
-/** 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. */
* 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
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;
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.
&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. */
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);
}
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? */
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);
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,