uint32_t bandwidthrate; /**< How many bytes does this OR add to its token
* bucket per second? */
uint32_t bandwidthburst; /**< How large is this OR's token bucket? */
+ /** How many bytes/s is this router known to handle? */
+ uint32_t advertisedbandwidth;
struct exit_policy_t *exit_policy; /**< What streams will this OR permit
* to exit? */
/* local info */
"router %s %s %d %d %d\n"
"platform %s\n"
"published %s\n"
- "bandwidth %d %d\n"
+ "bandwidth %d %d %d\n"
"onion-key\n%s"
"signing-key\n%s",
router->nickname,
published,
(int) router->bandwidthrate,
(int) router->bandwidthburst,
+ (int) router->advertisedbandwidth,
onion_pkey, identity_pkey);
tor_free(onion_pkey);
router->socks_port = atoi(tok->args[3]);
router->dir_port = atoi(tok->args[4]);
ports_set = 1;
- /* XXXX Remove this after everyone has moved to 0.0.6 */
- if (tok->n_args == 6) {
- router->bandwidthrate = atoi(tok->args[5]);
- router->bandwidthburst = router->bandwidthrate * 10;
- bw_set = 1;
- }
}
} else {
log_fn(LOG_WARN,"Wrong # of arguments to \"router\" (%d)",tok->n_args);
log_fn(LOG_WARN,"Redundant bandwidth line");
goto err;
} else if (tok) {
+ /* XXX set this to "< 3" once 0.0.7 is obsolete */
if (tok->n_args < 2) {
log_fn(LOG_WARN,"Not enough arguments to \"bandwidth\"");
goto err;
}
router->bandwidthrate = atoi(tok->args[0]);
router->bandwidthburst = atoi(tok->args[1]);
+ if(tok->n_args > 2)
+ router->advertisedbandwidth = atoi(tok->args[2]);
bw_set = 1;
}
r1.identity_pkey = pk2;
r1.bandwidthrate = 1000;
r1.bandwidthburst = 5000;
+ r1.advertisedbandwidth = 10000;
r1.exit_policy = NULL;
r1.nickname = "Magri";
r1.platform = tor_strdup(platform);
r2.dir_port = 0;
r2.onion_pkey = pk2;
r2.identity_pkey = pk1;
- r2.bandwidthrate = r2.bandwidthburst = 3000;
+ r2.bandwidthrate = r2.bandwidthburst = r2.advertisedbandwidth = 3000;
r2.exit_policy = &ex1;
r2.nickname = "Fred";
strcat(buf2, get_uname());
strcat(buf2, "\n"
"published 1970-01-01 00:00:00\n"
- "bandwidth 1000 5000\n"
+ "bandwidth 1000 5000 10000\n"
"onion-key\n");
strcat(buf2, pk1_str);
strcat(buf2, "signing-key\n");
test_eq(rp1->dir_port, r1.dir_port);
test_eq(rp1->bandwidthrate, r1.bandwidthrate);
test_eq(rp1->bandwidthburst, r1.bandwidthburst);
+ test_eq(rp1->advertisedbandwidth, r1.advertisedbandwidth);
test_assert(crypto_pk_cmp_keys(rp1->onion_pkey, pk1) == 0);
test_assert(crypto_pk_cmp_keys(rp1->identity_pkey, pk2) == 0);
test_assert(rp1->exit_policy == NULL);