diff options
author | Roger Dingledine <arma@torproject.org> | 2004-07-22 04:20:27 +0000 |
---|---|---|
committer | Roger Dingledine <arma@torproject.org> | 2004-07-22 04:20:27 +0000 |
commit | 06b72cc8f285b894d97fc155e2038e60de044956 (patch) | |
tree | b3f2fc31b3b5e847fb0ffa832b279825cf467f69 /src/or/router.c | |
parent | eb0a19c47536633497b778924cd987dc8c877a36 (diff) | |
download | tor-06b72cc8f285b894d97fc155e2038e60de044956.tar tor-06b72cc8f285b894d97fc155e2038e60de044956.tar.gz |
publish advertised_bandwidth in descriptor
svn:r2095
Diffstat (limited to 'src/or/router.c')
-rw-r--r-- | src/or/router.c | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/src/or/router.c b/src/or/router.c index 475742c22..5e295bfbc 100644 --- a/src/or/router.c +++ b/src/or/router.c @@ -124,6 +124,21 @@ void rotate_onion_key(void) log_fn(LOG_WARN, "Couldn't rotate onion key."); } +/** The last calculated bandwidth usage for our node. */ +static int advertised_bw = 0; + +/** Tuck <b>bw</b> away so we can produce it when somebody + * calls router_get_advertised_bandwidth() below. + */ +void router_set_advertised_bandwidth(int bw) { + advertised_bw = bw; +} + +/** Return the value we tucked away above, or zero by default. */ +int router_get_advertised_bandwidth(void) { + return advertised_bw; +} + /* Read an RSA secret key key from a file that was once named fname_old, * but is now named fname_new. Rename the file from old to new as needed. */ @@ -513,6 +528,7 @@ int router_rebuild_descriptor(void) { ri->platform = tor_strdup(platform); ri->bandwidthrate = options.BandwidthRate; ri->bandwidthburst = options.BandwidthBurst; + ri->advertisedbandwidth = router_get_advertised_bandwidth(); ri->exit_policy = NULL; /* zero it out first */ router_add_exit_policy_from_config(ri); ri->is_trusted_dir = authdir_mode(); |