[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]
[or-cvs] r16537: {tor} Do not show policy and bw in v2 statuses (tor/trunk/src/or)
Author: weasel
Date: 2008-08-14 08:37:07 -0400 (Thu, 14 Aug 2008)
New Revision: 16537
Modified:
tor/trunk/src/or/dirserv.c
tor/trunk/src/or/dirvote.c
tor/trunk/src/or/networkstatus.c
tor/trunk/src/or/or.h
Log:
Do not show policy and bw in v2 statuses
Modified: tor/trunk/src/or/dirserv.c
===================================================================
--- tor/trunk/src/or/dirserv.c 2008-08-14 12:37:00 UTC (rev 16536)
+++ tor/trunk/src/or/dirserv.c 2008-08-14 12:37:07 UTC (rev 16537)
@@ -1861,7 +1861,10 @@
int
routerstatus_format_entry(char *buf, size_t buf_len,
routerstatus_t *rs, const char *version,
- int first_line_only)
+ int first_line_only, int v2_format)
+/* XXX: first_line_only and v2_format should probably be be both
+ * replaced by a single purpose parameter.
+ */
{
int r;
struct in_addr in;
@@ -1912,8 +1915,7 @@
cp = buf + strlen(buf);
/* NOTE: Whenever this list expands, be sure to increase MAX_FLAG_LINE_LEN*/
r = tor_snprintf(cp, buf_len - (cp-buf),
- "s%s%s%s%s%s%s%s%s%s%s%s%s%s\n"
- "w Bandwidth=%d\n",
+ "s%s%s%s%s%s%s%s%s%s%s%s%s%s\n",
/* These must stay in alphabetical order. */
rs->is_authority?" Authority":"",
rs->is_bad_directory?" BadDirectory":"",
@@ -1927,8 +1929,7 @@
rs->is_stable?" Stable":"",
rs->is_unnamed?" Unnamed":"",
rs->is_v2_dir?" V2Dir":"",
- rs->is_valid?" Valid":"",
- router_get_advertised_bandwidth_capped(desc));
+ rs->is_valid?" Valid":"");
if (r<0) {
log_warn(LD_BUG, "Not enough space in buffer.");
return -1;
@@ -1944,14 +1945,24 @@
}
}
- summary = policy_summarize(desc->exit_policy);
- if (summary) {
- r = tor_snprintf(cp, buf_len - (cp-buf), "p %s\n", summary);
+ if (!v2_format) {
+ r = tor_snprintf(cp, buf_len - (cp-buf),
+ "w Bandwidth=%d\n",
+ router_get_advertised_bandwidth_capped(desc));
if (r<0) {
log_warn(LD_BUG, "Not enough space in buffer.");
return -1;
}
- tor_free(summary);
+
+ summary = policy_summarize(desc->exit_policy);
+ if (summary) {
+ r = tor_snprintf(cp, buf_len - (cp-buf), "p %s\n", summary);
+ if (r<0) {
+ log_warn(LD_BUG, "Not enough space in buffer.");
+ return -1;
+ }
+ tor_free(summary);
+ }
}
return 0;
@@ -2459,7 +2470,7 @@
if (digestmap_get(omit_as_sybil, ri->cache_info.identity_digest))
clear_status_flags_on_sybil(&rs);
- if (routerstatus_format_entry(outp, endp-outp, &rs, version, 0)) {
+ if (routerstatus_format_entry(outp, endp-outp, &rs, version, 0, 1)) {
log_warn(LD_BUG, "Unable to print router status.");
tor_free(version);
goto done;
Modified: tor/trunk/src/or/dirvote.c
===================================================================
--- tor/trunk/src/or/dirvote.c 2008-08-14 12:37:00 UTC (rev 16536)
+++ tor/trunk/src/or/dirvote.c 2008-08-14 12:37:07 UTC (rev 16537)
@@ -145,7 +145,7 @@
SMARTLIST_FOREACH(v3_ns->routerstatus_list, vote_routerstatus_t *, vrs,
{
if (routerstatus_format_entry(outp, endp-outp, &vrs->status,
- vrs->version, 0) < 0) {
+ vrs->version, 0, 0) < 0) {
log_warn(LD_BUG, "Unable to print router status.");
goto err;
}
@@ -924,7 +924,7 @@
/* Okay!! Now we can write the descriptor... */
/* First line goes into "buf". */
- routerstatus_format_entry(buf, sizeof(buf), &rs_out, NULL, 1);
+ routerstatus_format_entry(buf, sizeof(buf), &rs_out, NULL, 1, 0);
smartlist_add(chunks, tor_strdup(buf));
/* Second line is all flags. The "\n" is missing. */
smartlist_add(chunks,
Modified: tor/trunk/src/or/networkstatus.c
===================================================================
--- tor/trunk/src/or/networkstatus.c 2008-08-14 12:37:00 UTC (rev 16536)
+++ tor/trunk/src/or/networkstatus.c 2008-08-14 12:37:07 UTC (rev 16537)
@@ -1779,7 +1779,7 @@
networkstatus_getinfo_helper_single(routerstatus_t *rs)
{
char buf[RS_ENTRY_LEN+1];
- routerstatus_format_entry(buf, sizeof(buf), rs, NULL, 0);
+ routerstatus_format_entry(buf, sizeof(buf), rs, NULL, 0, 0);
return tor_strdup(buf);
}
Modified: tor/trunk/src/or/or.h
===================================================================
--- tor/trunk/src/or/or.h 2008-08-14 12:37:00 UTC (rev 16536)
+++ tor/trunk/src/or/or.h 2008-08-14 12:37:07 UTC (rev 16537)
@@ -3301,7 +3301,7 @@
int compressed);
int routerstatus_format_entry(char *buf, size_t buf_len,
routerstatus_t *rs, const char *platform,
- int first_line_only);
+ int first_line_only, int v2_format);
void dirserv_free_all(void);
void cached_dir_decref(cached_dir_t *d);
cached_dir_t *new_cached_dir(char *s, time_t published);