summaryrefslogtreecommitdiff
path: root/src/or/router.c
diff options
context:
space:
mode:
authorNick Mathewson <nickm@torproject.org>2014-09-23 08:46:35 -0400
committerNick Mathewson <nickm@torproject.org>2014-09-29 09:05:11 -0400
commit4903ab1caaf0b2631e6091b58b31eaff0c9f8424 (patch)
treebfd51b9ea637076a90f331e02c2367a18ee23ac2 /src/or/router.c
parent8527a2996675d9502551ccdd4224036a45aae47b (diff)
downloadtor-4903ab1caaf0b2631e6091b58b31eaff0c9f8424.tar.gz
tor-4903ab1caaf0b2631e6091b58b31eaff0c9f8424.zip
Avoid frequent strcmp() calls for AccountingRule
Generally, we don't like to parse the same thing over and over; it's best IMO to do it once at the start of the code.
Diffstat (limited to 'src/or/router.c')
-rw-r--r--src/or/router.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/src/or/router.c b/src/or/router.c
index 96d16bb326..dbe985ac78 100644
--- a/src/or/router.c
+++ b/src/or/router.c
@@ -1093,7 +1093,7 @@ decide_to_advertise_dirport(const or_options_t *options, uint16_t dir_port)
interval_length);
acc_bytes = options->AccountingMax;
- if (strcmp(options->AccountingRule, "sum") == 0)
+ if (get_options()->AccountingRule == ACCT_SUM)
acc_bytes /= 2;
if (effective_bw >=
acc_bytes / interval_length) {