diff options
author | Nick Mathewson <nickm@torproject.org> | 2012-05-10 17:27:16 -0400 |
---|---|---|
committer | Roger Dingledine <arma@torproject.org> | 2012-05-10 17:41:31 -0400 |
commit | 02a650786b21e4f3c255d686a3b5df875b2d66b5 (patch) | |
tree | a313aa8848622dfa7fcb3bdd6fc7630002b48ae5 /src/or/routerparse.h | |
parent | 62f8e3926d62ff4aaefedfe89355f04f3a8d74fa (diff) | |
download | tor-02a650786b21e4f3c255d686a3b5df875b2d66b5.tar.gz tor-02a650786b21e4f3c255d686a3b5df875b2d66b5.zip |
Fix O(n^2) performance when parsing a big pile of extrainfos
We were doing an O(n) strlen in router_get_extrainfo_hash() for
every one we tried to parse. Instead, have
router_get_extrainfo_hash() take the length of the extrainfo as an
argument, so that when it's called from
extrainfo_parse_from_string(), it doesn't do a strlen() over the
whole pile of extrainfos.
Diffstat (limited to 'src/or/routerparse.h')
-rw-r--r-- | src/or/routerparse.h | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/src/or/routerparse.h b/src/or/routerparse.h index b274d2196c..6486a09c73 100644 --- a/src/or/routerparse.h +++ b/src/or/routerparse.h @@ -19,7 +19,7 @@ int router_get_networkstatus_v2_hash(const char *s, char *digest); int router_get_networkstatus_v3_hash(const char *s, char *digest, digest_algorithm_t algorithm); int router_get_networkstatus_v3_hashes(const char *s, digests_t *digests); -int router_get_extrainfo_hash(const char *s, char *digest); +int router_get_extrainfo_hash(const char *s, size_t s_len, char *digest); #define DIROBJ_MAX_SIG_LEN 256 int router_append_dirobj_signature(char *buf, size_t buf_len, const char *digest, |