diff options
author | Nick Mathewson <nickm@torproject.org> | 2004-08-07 02:46:16 +0000 |
---|---|---|
committer | Nick Mathewson <nickm@torproject.org> | 2004-08-07 02:46:16 +0000 |
commit | f6cc21874243b4d84a2db212e5c66058365bd7e7 (patch) | |
tree | edde9db07ea5ff6a3f28591302fea7caac8388f9 /src/or/router.c | |
parent | f47fe829dd722b502a186b9c437cf8f57bf55405 (diff) | |
download | tor-f6cc21874243b4d84a2db212e5c66058365bd7e7.tar.gz tor-f6cc21874243b4d84a2db212e5c66058365bd7e7.zip |
Refactor ISO-style (yyyy-mm-dd hh:mm:ss) time parsing into util.c; rename format/parse_rfc1123_time; make rephist remember used bandwidth; published used bandwidth in descriptors in 15-minute chunks. Breaks unittests.
svn:r2182
Diffstat (limited to 'src/or/router.c')
-rw-r--r-- | src/or/router.c | 11 |
1 files changed, 8 insertions, 3 deletions
diff --git a/src/or/router.c b/src/or/router.c index fb53c8a002..e5fbaff892 100644 --- a/src/or/router.c +++ b/src/or/router.c @@ -581,6 +581,7 @@ int router_dump_router_to_string(char *s, int maxlen, routerinfo_t *router, int written; int result=0; struct exit_policy_t *tmpe; + char *bandwidth_usage; #ifdef DEBUG_ROUTER_DUMP_ROUTER_TO_STRING char *s_tmp, *s_dup; const char *cp; @@ -615,8 +616,11 @@ int router_dump_router_to_string(char *s, int maxlen, routerinfo_t *router, } /* Encode the publication time. */ - strftime(published, 32, "%Y-%m-%d %H:%M:%S", gmtime(&router->published_on)); + format_iso_time(published, router->published_on); + /* How busy have we been? */ + bandwidth_usage = rep_hist_get_bandwidth_lines(); + /* Generate the easy portion of the router descriptor. */ result = snprintf(s, maxlen, "router %s %s %d %d %d\n" @@ -626,7 +630,7 @@ int router_dump_router_to_string(char *s, int maxlen, routerinfo_t *router, "opt uptime %ld\n" "bandwidth %d %d %d\n" "onion-key\n%s" - "signing-key\n%s", + "signing-key\n%s%s", router->nickname, router->address, router->or_port, @@ -642,7 +646,8 @@ int router_dump_router_to_string(char *s, int maxlen, routerinfo_t *router, (int) router->bandwidthrate, (int) router->bandwidthburst, (int) router->advertisedbandwidth, - onion_pkey, identity_pkey); + onion_pkey, identity_pkey, + bandwidth_usage); tor_free(onion_pkey); tor_free(identity_pkey); |